Whirlpool ExampleWhirlpool is a 512-bit cryptographic hash function, and was created by Vincent Rijmen (one of the AES creators) and Paulo Barreto, in 2000. It is recommended by the NESSIE project, and adopted by the IEC. It is named after the Whirlpool galaxy in Canes Venatici (M51, or NGC 5194), which is one of the first one to be identified as having a spiral structure. It is one of the three hashing methods used in TrueCrypt (RIPEMD-160, SHA-512, and WHIRLPOOL). [Theory] The results are then:
|
Examples
- Try "The quick brown fox jumps over the lazy dog". Try!, which should give a Whirlpool hash of: B97DE512E91E3828B4 ... 403CB55AE31F03AD62A5EF54E42EE82C3FB35 Check
- Try "Test vector from febooti.com". Try!, which should give a Whirlpool hash of: e006fb0f4817f50191794177e61a5 .... 203e0b5fa32b510c42d03bfc7b96c2769a740 Check
- Try "". Try!, which should give a Whirlpool hash of: 19fa61d75522a4 ... 8e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3 Check
Sample code
using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Math; using Org.BouncyCastle.Crypto.Paddings; public void checkWhirl(string message) { if (message == null) return; System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); Org.BouncyCastle.Crypto.Digests.WhirlpoolDigest w = new Org.BouncyCastle.Crypto.Digests.WhirlpoolDigest(); byte[] data = encoding.GetBytes(message); w.Reset(); w.BlockUpdate(data, 0, data.Length); byte[] o = new byte[w.GetDigestSize()]; w.DoFinal(o, 0); whirl = ByteToString(o); } public static string ByteToString(CryptoStream buff) { string sbinary = ""; int b = 0; do { b = buff.ReadByte(); if (b != -1) sbinary += ((char)b); } while (b != -1); return (sbinary); }