Created
August 23, 2014 09:37
-
-
Save alco/54beac75f1188bbe280b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Hashids = require("../lib/hashids"); | |
var hashids = new Hashids(); | |
var bignums = [ | |
9007199254740992, | |
"9007199254740992 (2^53)", | |
9007199254740993, | |
"9007199254740993 (2^53+1)", | |
18014398509481984, | |
"18014398509481984 (2^54)", | |
18014398509481985, | |
"18014398509481985 (2^54+1)", | |
1152921504606846976, | |
"1152921504606846976 (2^60)", | |
]; | |
for (var i = 0; i < bignums.length; i+=2) { | |
var num = bignums[i]; | |
console.log(bignums[i+1]); | |
console.log(num); | |
console.log(hashids.encrypt(num)); | |
console.log("---"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hashids import Hashids | |
nums = [ | |
("9007199254740992 (2^53)", 9007199254740992), | |
("9007199254740993 (2^53+1)", 9007199254740993), | |
("18014398509481984 (2^54)", 18014398509481984), | |
("18014398509481985 (2^54+1)", 18014398509481985), | |
("1152921504606846976 (2^60)", 1152921504606846976), | |
] | |
hashids = Hashids() | |
for s, num in nums: | |
print s | |
print num | |
print hashids.encrypt(num) | |
print "---" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9007199254740992 (2^53) | |
9007199254740992 | |
mNWyy8yjQYE | |
--- | |
9007199254740993 (2^53+1) | |
9007199254740992 | |
mNWyy8yjQYE | |
--- | |
18014398509481984 (2^54) | |
18014398509481984 | |
7KpVVxJ6pOy | |
--- | |
18014398509481985 (2^54+1) | |
18014398509481984 | |
7KpVVxJ6pOy | |
--- | |
1152921504606846976 (2^60) | |
1152921504606847000 | |
YkZM1Vrj7yp0 | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9007199254740992 (2^53) | |
9007199254740992 | |
mNWyy8yjQYE | |
--- | |
9007199254740993 (2^53+1) | |
9007199254740993 | |
n6WOO7OkrgY | |
--- | |
18014398509481984 (2^54) | |
18014398509481984 | |
7KpVVxJ6pOy | |
--- | |
18014398509481985 (2^54+1) | |
18014398509481985 | |
8LMKKyYqMOg | |
--- | |
1152921504606846976 (2^60) | |
1152921504606846976 | |
YkZM1Vrj77o0 | |
--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From perl (zakame/hashids.pm@8bc2925)