static byte[] MD4(byte[] buffer) { using (var md4 = new MD4()) { var hash = md4.ComputeHash(buffer); Array.Clear(buffer, 0, buffer.Length); return(hash); } }
static byte[] ComputeNtlmPassword(string password) { var buffer = new byte[21]; // create NT password using (var md4 = new MD4()) { var data = password == null ? new byte[0] : Encoding.Unicode.GetBytes(password); var hash = md4.ComputeHash(data); Buffer.BlockCopy(hash, 0, buffer, 0, 16); // clean up Array.Clear(data, 0, data.Length); Array.Clear(hash, 0, hash.Length); } return(buffer); }
static byte[] ComputeNtlmPassword (string password) { var buffer = new byte[21]; // create NT password using (var md4 = new MD4 ()) { var data = password == null ? new byte[0] : Encoding.Unicode.GetBytes (password); var hash = md4.ComputeHash (data); Buffer.BlockCopy (hash, 0, buffer, 0, 16); // clean up Array.Clear (data, 0, data.Length); Array.Clear (hash, 0, hash.Length); } return buffer; }