Skip to content

Instantly share code, notes, and snippets.

@Gustav-Simonsson
Created December 19, 2014 19:16
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 Gustav-Simonsson/39801db33f0a11239eb8 to your computer and use it in GitHub Desktop.
Save Gustav-Simonsson/39801db33f0a11239eb8 to your computer and use it in GitHub Desktop.
scrypt params test
package main
import (
"fmt"
"time"
"math"
"code.google.com/p/go.crypto/scrypt"
)
func main() {
Test1()
}
func Test1() {
salt := []byte{'s', 'a', 'l', 't'}
startTime := time.Now()
dk, err := scrypt.Key([]byte("supersecret"), salt, int(math.Pow(2,18)), 8, 1, 32)
if (err != nil) {
fmt.Println("Test 1 error:", err)
} else {
elapsed := time.Since(startTime)
fmt.Println("Test 1 dk len:", len(dk))
fmt.Println("Test 1 time::", elapsed.Seconds(),"s")
}
}
// Bash:
20:15:39 ~/eth/go/misc> go build goscrypt.go
20:15:42 ~/eth/go/misc> /usr/bin/time -f '%Uu %Ss %er %MkB %C' "$@" ./goscryptTest 1 dk len: 32
Test 1 time:: 1.155116692 s
1.15u 0.01s 1.15r 264104kB ./goscrypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment