Created
March 2, 2017 20:35
-
-
Save ik5/58ac514a58c5644fa482afb3a237d0e2 to your computer and use it in GitHub Desktop.
example on using scrypt
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 ( | |
"crypto/rand" | |
"fmt" | |
"golang.org/x/crypto/scrypt" | |
) | |
func main() { | |
salt := make([]byte, 9046) | |
_, err := rand.Read(salt) | |
if err != nil { | |
fmt.Println("error:", err) | |
return | |
} | |
dk, err := scrypt.Key([]byte("some password"), salt, 16384, 8, 1, 32) | |
if err != nil { | |
fmt.Println("Opps: ", err) | |
return | |
} | |
fmt.Printf("%x\n", dk) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment