Created
September 13, 2019 23:11
-
-
Save parzibyte/44f3d5d2b8350e57b87c24254e1a3830 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"golang.org/x/crypto/bcrypt" | |
) | |
func main() { | |
contraseñaPlana := "123" | |
contraseñaPlanaComoByte := []byte(contraseñaPlana) | |
hash, err := bcrypt.GenerateFromPassword(contraseñaPlanaComoByte, bcrypt.DefaultCost) //DefaultCost es 10 | |
if err != nil { | |
fmt.Println(err) | |
} | |
hashComoCadena := string(hash) | |
fmt.Printf("El hash generado a partir de %s es %s\n", contraseñaPlana, hashComoCadena) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment