Skip to content

Instantly share code, notes, and snippets.

@aycanirican
Created July 13, 2019 09:28
Show Gist options
  • Save aycanirican/1c313cf7b084fb250711aed5a28183be to your computer and use it in GitHub Desktop.
Save aycanirican/1c313cf7b084fb250711aed5a28183be to your computer and use it in GitHub Desktop.
// password based key derivation function 1 with SHA256 (PBKDF1SHA256) in golang
// strength 2^17
func PBKDF1SHA256(pass []byte, salt []byte) []byte {
h := sha256.Sum256(append(pass, salt...)) // first_hash
for i := 0; i <= 1<<17; i++ {
h = sha256.Sum256(h[:])
}
return h[:]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment