Take this stackoverflow question:
Generate a Hash from string in Javascript/jQuery
I'd like to do exactly that, however I'd like to generate the same sized hash no matter what size string is used to generate the hash.
For instance take the following
function genorateHash(string){
...do something...
return hash
}
genorateHash("hello") output >> "3NCI4KSI"
genorateHash("THIS IS A LONGER STING") output >> "4J4IXYEK"
genorateHash("hello") output >> "3NCI4KSI" (Notice "hello" regenerates the same hash every time.)
Notice "hello"
regenerates the same hash every time.
How can this be accomplished?
(I understand it's unlikely to generate the same hash, it something like 8^n?)
Also Im working with nodeJS and I haven't seen any npm
packages that accomplish this:
https://www.npmjs.com/package/id-generator
https://www.npmjs.com/package/shortid
Thanks