I\'m trying to develop a system that can change my string into a unique integral value, meaning say for example the word \"account\" has an encrypted numerical value of 0891
Assign a unique prime value to each alphabet in increasing order(order not necessary).
Please Note : As multiplication of prime numbers is a unique result which can only be multiplied by these numbers, it will give you unique values for each word.
Algorithm :
int hash = 0;
forEach (int i = 0 ; i < word.length ; i++)
{
hash *= (prime[c[i]] ** (length - i));
}
prime - An array to store prime values corresponding to each
powered to (length - 1) to give value to the place at which this character occurs to maintain a dictionary order.
This algorithm will give sufficiently large values that will overrun your array.
Also : words will smaller lengths may give lower values than some words with larger length and it may affect your dictionary order but I'm not sure why do you want a dictionary order as the uniqueness will be maintained here.