Whirlpool Hash Function in Python
Hash Function is a function which has a huge role in making a System Secure as it converts normal data given to it as an irregular value of fixed length. We can imagine it to be a Shaker in our homes.
When we put data into this function it outputs an irregular value. The Irregular value it outputs is known as “Hash Value”.Hash Values are simply number but are often written in Hexadecimal. Computers manage values as Binary. Hash value is also a data and are often managed in Binary.
Whirlpool Hash Function
Whirlpool is a cryptographic hash function created by Vincent Rijmen and Paulo S.L.M. Barreto. It was first published in 2000 and revised in 2001 and 2003. It was derived form square and Advanced Encryption Standard. It is a block cipher hash function and designed after square block cipher. It takes less than 2^256 bits length input and convert it in 512 bit hash. The first version of whirlpool is called Whirlpool-0 and changed to Whirlpool-T after it’s first revision in 2001 . In this version the S-box is changed and become easier to use in hardware. In 2002 a vulnerability was founded in the Whirlpool-0’s diffusion matrix which was removed by changing the matrix and the name was also changed from Whirlpool-T to Whirlpool.
Every block cipher in whirlpool is a 8*8 matrix. The state of the function changes in ever round by using four operations:
Operation Name Function Mix Rows(MR) It is a right multiplication of each row by an 8*8 matrix. Substitute Bytes(SB) It is a simple table lookup and gives nonlinear mapping. Add Round Key(AK) In this the 512 bits of the round key is goes through XOR with 512 bit of current state. Shift Columns(SC) In this except the first column of current state are cyclically downward shifted.
Hash Value is calculated by using the formula:
State = MR*AK*SC*SB(State)
Install whirlpool library using
pip install whirlpool
The hashed value is
The hashed value is