Skip to content

Commit

Permalink
feat(MultiHash): register murmur3-32 and m3urmur-128
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed May 2, 2018
1 parent da795b7 commit eac230c
Show file tree
Hide file tree
Showing 2 changed files with 16 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 @@ -54,6 +54,8 @@ static HashingAlgorithm()
Register("blake2s-160", 0xb254, 160 / 8, () => new BouncyDigest(new BC.Blake2sDigest(160)));
Register("blake2s-224", 0xb25c, 224 / 8, () => new BouncyDigest(new BC.Blake2sDigest(224)));
Register("blake2s-256", 0xb260, 256 / 8, () => new BouncyDigest(new BC.Blake2sDigest(256)));
Register("murmur3-32", 0x23, 32 / 8);
Register("murmur3-128", 0x22, 128 / 8);
}

/// <summary>
Expand Down
14 changes: 14 additions & 0 deletions test/MultiHashTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,5 +398,19 @@ public void CheckMultiHash()
}
}

[TestMethod]
public void Murmur3_Decode()
{
var hash = "2304243ddb9e".ToHexBuffer().ToBase58();
var mh = new MultiHash(hash);
Assert.AreEqual("murmur3-32", mh.Algorithm.Name);
Assert.AreEqual("243ddb9e", mh.Digest.ToHexString());

hash = "2210acfe9c5bbf88f075c0c4df0464430ead".ToHexBuffer().ToBase58();
mh = new MultiHash(hash);
Assert.AreEqual("murmur3-128", mh.Algorithm.Name);
Assert.AreEqual("acfe9c5bbf88f075c0c4df0464430ead", mh.Digest.ToHexString());
}

}
}

0 comments on commit eac230c

Please sign in to comment.