Name of the hash algorithms and create an unhash function Below is a function to hash a string into a number. I'm curious what would be the name of the below hash function and what would be best approach to create an unhash function to turn the number into a string (ex. 61752 to abc)?
function hash(str){
    const letters = &quot;abcdefghijklmnopqrstuvwxyz&quot;

    let h = 9

    for (let i = 0; i &lt; str.length; i++) {
        let v = letters.indexOf(str[i])
        h = h * 19 + v
    }

    return h
}

console.log(hash(&quot;abc&quot;)) // will return 61752
EDIT - Per the helpful comments, this question involves a sort of broken base19 conversion with redundant characters from t through z.  As such the below does not reverse for any letters after 's'.  It could be fixed but I presume the question is just an intellectual exercise of some kind anyway.  It obviously is NOT a hash, nor is it an efficient coding system, snugly fitting 8 characters in a less than handy 34 bits.
From my rather layman point-of-view, it was difficult to initially spot as a base19 conversion due to the fact it's backwards (we treat the initial string as base19) and because of the way it multiplies 19 in a loop rather than explicitly $19^i$ (yeah I know...).

To reverse up to 's':
$61752 \mod 19 = 2$
We then take the rounded down result of 61752/19
Were left with $3250 \mod 19 = 1$
We then take the rounded down result of 3250/19
Were left with $171 \mod 19 = 0$
Here it is in Javascript
function rehash(str){
const letters = &quot;abcdefghijklmnopqrstuvwxyz&quot;;var out=&quot;&quot;;

while (str&gt;9) {
  out = letters.charAt(str%19) + out;
  str=Math.floor(str/19)
}
return out}