JHash

JHash is a one way hash function which is developed for my MS Cryptography course work. Its my first attempt in this field, i am definitely looking for your suggestion to improve this algorithm. If you have any comment, suggestion or any cryptanalysis result please write a comment on this page at the bottom.

I have also implemented this algorithm using Java. View JHash Demo or if you are interested download Source Code to improve it further.

Working of JHash:

h = JHash (M)

where M is a variable length message and JHash (M) is the function that generates h a fix length i.e. 16 bytes or 256 bits hash value. Following diagram describes the high level operations of the JHash algorithm.

JHash Algorithm

Basic JHash operation is based on following principles. The input message M is a variable length message, which is converted in a matrix of S * 16; where S is the length of the Standard Message (described shortly) and 16 is the number of bits of a Unicode character. Standard Message is the result of a process in which original message is trimmed i.e. all space characters are removed from the original message. This trimmed message is then appended iteratively in such a way that the message size is the least multiple of the FACTOR.

Once the Standard Message is generated it is converted into a matrix of S * 16 such that each row of the matrix is the 16 bits representation of the characters of the Standard Message. Then the process of generating new value/state for each cell of the matrix starts. The new cell value is generated by adding all the values of its direct neighbors and applying XOR between the cell value and mode 2 of the sum generated from the neighbors.

a’i,j = ai,j XOR (Ni,j mod 2)

Ni,j = ai-1,j-1 + ai-1,j + ai-1,j+1 + ai,j-1 + ai,j+1 + ai+1,j-1 + ai+1,j + ai+1,j+1

This process uses column iterative approach i.e. its starts from first column of the first row till last column of the same row than goes to first column of the next row and till the last column and continues until all the new cell values/states are calculated. The new value that is generated immediately updated in the matrix and it is used in the new cell value calculation for the corresponding neighboring cell.

Once all the new states of the matrix are calculated then the process of calculating the 256 bits JHash value starts. As we know that we have created a matrix with 16 columns the last step calculates the 16 byte JHash value by adding all the respective column values for all rows and taking mod FACTOR. In other words the values at first column for all rows are added and modulus FACTOR is applied on the resulting sum to calculate first byte (16 bits) of the hash value then process continues to calculate second byte using second column and till the sixteenth byte using sixteenth column. All the bytes are arranged in their respective order to generate the JHash value.

 

Security of the JHash:
For one-way function it is required that the inverse of the value is computationally hard to compute or impossible. JHash successfully fulfills this requirement:

Firstly as user can’t determine what the sum of the column was? Because FACTOR is unknown. If he could guess the sum all 16 bytes seperately but can’t go further to figure out matrix state.

Secondly as the rows of the matrix are variable it is impossible to reverse the states of the matrix to its original state by going backwards.

Also a single bit or character change in the message changes the whole JHash value which also provides security and randomness.

Future improvements:
JHash algorithm is developed as the course requirement so there are many improvements that will be done in future. Firstly most of the JHash values contain repeated symbols, which should be removed in future enhancements.

FACTOR used in the JHash algorithm can be the weak point of the algorithm; need to do more analysis; how or what FACTOR is used to improve the security and randomness of the JHash values.

1 Comment so far

  1. anuragh on February 3rd, 2007

    Dear,
    i have gone through ur blog regarding the newly created Hash algorithm as part of ur MS program.If u mention the internal states tht message undergoes when passed through your algorithm…….then we can comment…clearly…

    moreover a god news is tht NSA is going to announce publicly…to develop a standard hash algorithm……..as it received complaints rearding SHA…..

    so all the best……

    P.S…sorry for writing such a big essay

Leave a reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word