• Source
    1. /* package whatever; // don't place package name! */
    2.  
    3. import java.util.*;
    4. import java.lang.*;
    5. import java.io.*;
    6.  
    7. /* Name of the class has to be "Main" only if the class is public. */
    8. class Ideone
    9. {
    10. public static void main (String[] args) throws java.lang.Exception
    11. {function hasher(hashedValue)
    12. {
    13. var hash = 7;
    14. var letters = "1c1707e8a20719056bfc9a232527c5bd";
    15. for(var i = 0; i < hashedValue.length; i++)
    16. {
    17. hash = (hash * 23 + letters.indexOf(hashedValue[i]))
    18. }
    19. return hash;
    20. }
    21. function unhasher(hashNbr) {
    22. var strpos = [];
    23. var rst = 0;
    24. var result = [];
    25. var hash = hashNbr;
    26. var letters = 'atdebilaeokrotum';
    27.  
    28. for( i = 10; i > 0; i-- ){
    29. rst = ( hash % 23 );
    30. strpos[i] = rst;
    31. hash = (hash - rst)/23;
    32. result[i-1]= letters.charAt(strpos[i]);
    33. }
    34. return result.join(''); // array of chars to string
    35. }
    36. // your code goes here
    37. }
    38. }