Created
December 19, 2014 19:16
-
-
Save Gustav-Simonsson/39801db33f0a11239eb8 to your computer and use it in GitHub Desktop.
scrypt params test
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" | |
"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