Skip to content

Commit

Permalink
feat(MultiHash): implement md4 and md5
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed May 2, 2018
1 parent eac230c commit 1fa48fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Registry/HashingAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ static HashingAlgorithm()
Register("blake2s-256", 0xb260, 256 / 8, () => new BouncyDigest(new BC.Blake2sDigest(256)));
Register("murmur3-32", 0x23, 32 / 8);
Register("murmur3-128", 0x22, 128 / 8);
Register("md4", 0xd4, 128 / 8, () => new BouncyDigest(new BC.MD4Digest()));
Register("md5", 0xd5, 128 / 8, () => MD5.Create());
}

/// <summary>
Expand Down
16 changes: 16 additions & 0 deletions test/Cryptography/HashingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ class TestVector
Input = "fd6dd3b63dc7b9664895c51fc17c57d59c349621dd3c5694a3cc404c660c2cc47d83d2f0e3d2a28a3aa2f0a710db54",
Digest = "c8db32bf81bf75621db30264750954f8"
},

// From https://en.wikipedia.org/wiki/MD4
new TestVector
{
Algorithm = "md4",
Input = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog").ToHexString(),
Digest = "1bee69a46ba811185c194762abaeae90",
},

// From https://en.wikipedia.org/wiki/MD5
new TestVector
{
Algorithm = "md5",
Input = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog").ToHexString(),
Digest = "9e107d9d372bb6826bd81d3542a419d6",
},
};

/// <summary>
Expand Down

0 comments on commit 1fa48fd

Please sign in to comment.