"use strict";
var undoHash = (function() {
return function calculate(hash) {
var letters = 'acdegilmnoprstuw',
factor = 37,
result = "",
index = -1;
while( hash > factor ) {
index = Math.round( hash % factor );
if( index > letters.length )
return "Invalid hash!";
result = letters[ index ] + result;
hash /= factor;
}
return result;
}
})();
//Usage
console.log( undoHash(680131659347) );
console.log( undoHash(917239788389713) );
console.log( undoHash(18882332479) );