## Tanti Hashing Function (THF)

**Abstract Category:**

**I.T.**

**Course / Degree:**n/a

**Institution / University:**G.F. Abela Junior College, Malta

**Published in:**2005

**Long Essay Abstract / Summary:**

Had we just used this function:

Input -> [Input MOD Max Output] -> Output

we would have got a 1:1 output if the input was less than Max Output but then again we wouldn't even need the MOD function because the output numbers would be equal to the input numbers. Therefore we need to add something to scramble up the outputs.

THF works like this:

Input -> [(Input * Hash Multiple) MOD Max Output] -> Output

The addition of the Hash Multiple makes a whole lot of difference because the inputs will be enlarged and the numbers which result in a number >= Max Output will be reduced by MOD into a new number. Since all the input values will be multiplied by the same number MOD will return no repeated output. So whether it is

1 MOD 4 = 1

2 MOD 4 = 2

3 MOD 4 = 3

4 MOD 4 = 0

OR

1*7 MOD 4 = 3

2*7 MOD 4 = 2

3*7 MOD 4 = 1

4*7 MOD 4 = 0

the 1:1 property of MOD will be conserved (of course the larger the max output, the more random the permutation of the outputs).

However not any multiple will do... It must be a multiple which does not simplify with Max Output when in a fraction.

EG

A multiple of 2 with a Max Output of 4 is not good because 2/4 = 1/2

A multiple of 4 with an output of 6 isn't good either because 4/6 = 2/3

The reason for this is due to the MOD function. Since MOD is a division, the following shall occur if the above rule is not obeyed:

1*2 MOD 4 -is like-> 1*2/4 = 1*1/2 -which is-> 1 MOD 2

So due to this the Max Output (divisor) will become smaller which means that the range of outputs will be reduced and the following shall occur:

1*2 MOD 4 = 2

2*2 MOD 4 = 0

3*2 MOD 4 = 2

4*2 MOD 4 = 0

So the range will be reduced and the repetition will be increased and so the 1:1 property of THF will not apply!

I heard something about multiplying the input with a prime number to achieve a 1:1 output. This is not true as Max Output could still be a multiple of the prime number EG if the prime number is 7 and Max Output is 14, 7/14 = 1/2 which means that the error mentioned earlier will occur.

Notice that this algorithm only applies for a 1:1 situation and may not be useful for database situations.

Let’s say you want to encrypt the string:

ABCDEFGH

You use THF on the position of each character to determine where the new positions should be.

1(A) -> [THF]+1 -> 6

2(B) -> [THF]+1 -> 3

3(C) -> [THF]+1 -> 8

4(D) -> [THF]+1 -> 5

5(E) -> [THF]+1 -> 2

6(F) -> [THF]+1 -> 7

7(G) -> [THF]+1 -> 4

8(H) -> [THF]+1 -> 1

So the new string based on the resulting positions will be:

HEBGDAFC

When you need to decrypt this cipher text back to clear text you just use a counter and use THF on each value specified by the counter to know which character comes next in the plain text.

1 -> [THF]+1 -> 6(A)

2 -> [THF]+1 -> 3(B)

3 -> [THF]+1 -> 8(C)

4 -> [THF]+1 -> 5(D)

5 -> [THF]+1 -> 2(E)

6 -> [THF]+1 -> 7(F)

7 -> [THF]+1 -> 4(G)

8 -> [THF]+1 -> 1(H)

So based on knowing which character goes into the next position you can reassemble the text into:

ABCDEFGH

As you can notice there is no need to use any reversing equations to know where each character is to be placed to decode the cipher text. This is due to the fact that you will have to traverse each character position anyway! :)

Note that you can use a password to generate a hash multiple since it is the hash multiple that scrambles the order of the characters.

**Long Essay Keywords/Search Tags:**

Hash, Hashing, Collision 1:1, Encryption

**This Long Essay Abstract may be cited as follows:**

No user preference. Please use the standard reference methodology.

**Submission Details**: Long Essay Abstract submitted by **Marc Tanti** from **Malta** on 15-Apr-2005 23:40.

Abstract has been viewed 2685 times (since 7 Mar 2010).

**Marc Tanti Contact Details:** Email: marctanti@gmail.com

**Disclaimer**

Great care has been taken to ensure that this information is correct, however ThesisAbstracts.com cannot accept responsibility for the contents of this Long Essay abstract titled "Tanti Hashing Function (THF)". This abstract has been submitted by Marc Tanti on 15-Apr-2005 23:40. You may report a problem using the contact form.

© Copyright 2003 - 2024 of ThesisAbstracts.com and respective owners.