Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. SmallHash = {
  2. encode: function (input, ranges, base)
  3. var result = 0
  4. for offset = ranges.length - 1 downto 0
  5. result = result * ranges[input[offset]]
  6. result = result + input[offset];
  7.  
  8. return int2str(result, base)
  9. },
  10.  
  11. decode: function (input, ranges, base) {
  12. input = str2int(input, base)
  13. var result = [];
  14.  
  15. for offset = 0 to ranges - 1
  16. result[offset] = inputs % ranges[offset]
  17. inputs = inputs / ranges[offset]
  18.  
  19. return result;
  20. }
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement