Home > Mobile >  Generate MD4 Hash from Textfile in C#
Generate MD4 Hash from Textfile in C#

Time:10-01

I want to generate a MD4 Hash from the textfile content, but can not find something same as MD5 in System.Security.Cryptography

        {
            using (var md5 = MD5.Create())
            {
                using (var stream = File.OpenRead(fileName))
                {
                    return BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", string.Empty);
                    
                }
            }
        }

Could anyone help me how to generate MD4 Hash from textfile content?

CodePudding user response:

AFAIK and could find online, C# does not come with any functionality to generate MD4 Hashes.

If you truly need to generate MD4 Hashes, you either:

  • need to find a nuget package that offers this (since MD4 is already made obsolete because its a security vulnerability I would not get my hopes up for packages to exist)

  • or code the algorithm yourself. See here for a github example that I found.

  • Related