hashids.js

hashids.js

지원 언어:

JavaScript, Ruby, Python, Java, Scala, PHP, Perl, Perl 6, Swift, Clojure, Objective-C, C, C++11, D, F#, Go, Erlang, Lua, Haskell, OCaml, Elixir, Rust, Smalltalk, ColdFusion, Kotlin, Nim, VBA, Haxe, Crystal, Elm, ActionScript, Bash, R, TSQL, PostgreSQL, PLpgSQL, Dart, Io, Julia and for .NET

간단 예제:

var hashids = new Hashids("this is my salt"),
  id = hashids.encode(1, 2, 3),
  numbers = hashids.decode(id);

salt 값(alphabet) 추가 예제:

function toHex(input) {

  var hash = "",
    alphabet = "0123456789abcdef",
    alphabetLength = alphabet.length;

  do {
    hash = alphabet[input % alphabetLength] + hash;
    input = parseInt(input / alphabetLength, 10);
  } while (input);

  return hash;

}