Skip to content

Instantly share code, notes, and snippets.

@ik5
Created March 2, 2017 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik5/58ac514a58c5644fa482afb3a237d0e2 to your computer and use it in GitHub Desktop.
Save ik5/58ac514a58c5644fa482afb3a237d0e2 to your computer and use it in GitHub Desktop.
example on using scrypt
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