I have this function that I found to hash a string, I have been attempting for some hours now to reverse this function to take the hash and return the string. I am not too familiar with left and right shifts, what exactly do they do in the case of this function and would reversing it be even possible? I have used the string "luxor" for my tests and I get "250B0C5E" as the hash but have been unable to get a string back that matches "luxor". I have attempted switching the shifts from left to right and moving the charcodeat but still no success.
function HashString(command) {
let hash = 0;
let string = command.toLowerCase();
for(let i=0; i < string.length; i++) {
let letter = string[i].charCodeAt();
hash = hash + letter;
hash += (hash << 10 >>> 0);
hash ^= (hash >>> 6);
hash = hash >>> 0
}
hash += (hash << 3);
if (hash < 0) {
hash = hash >>> 0
}
hash ^= (hash >>> 11);
hash += (hash << 15);
if (hash < 0) {
hash = hash >>> 0
}
return hash.toString(16).toUpperCase();
}