Created
March 4, 2012 10:43
-
-
Save Thorium/1972350 to your computer and use it in GitHub Desktop.
SHA512 hash code from a string
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
let generateHash text = | |
let getbytes : (string->byte[]) = System.Text.Encoding.UTF8.GetBytes | |
use algorithm = new System.Security.Cryptography.SHA512Managed() | |
text |> (getbytes >> algorithm.ComputeHash >> System.Convert.ToBase64String) | |
//use example: | |
let id, time, secretkey = "1", System.DateTime.Now.ToString("yyyyMMddhhmmss"), "mysecret" | |
generateHash (secretkey + id + time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment