Created
April 13, 2016 14:46
-
-
Save Thorium/72a4bffca190c53b934e406d6135d1fe to your computer and use it in GitHub Desktop.
Calculate MD5 hash that can be used when interacting with a PHP-website. Note: MD5 has been cracked and shouldn't be used in new systems.
This file contains hidden or 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 phpMd5 (dataToHash:string) = | |
use md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); | |
let encodedBytes = dataToHash |> System.Text.ASCIIEncoding.Default.GetBytes |> md5.ComputeHash | |
System.Text.RegularExpressions.Regex.Replace(System.BitConverter.ToString(encodedBytes), "-", "").ToLower() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment