Created
June 11, 2012 11:43
-
-
Save miekg/2909715 to your computer and use it in GitHub Desktop.
Simple hashing and salting algo in Go
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/sha1" | |
"fmt" | |
"io" | |
) | |
const ITER = 100000 | |
func main() { | |
pass := "ik ben een wachtwoord" | |
salt := "4389fhdjn" | |
hash := sha1.New() | |
var encr []byte | |
io.WriteString(hash, salt + pass) | |
for i := 0; i < ITER; i++ { | |
encr = hash.Sum(nil) | |
io.WriteString(hash, string(encr)) | |
} | |
fmt.Printf("%d %X\n", ITER, encr) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
btw, dit zijn ITER+1 iteraties.