Created
January 7, 2015 06:46
-
-
Save Ke-/30ea9fb28670e8403536 to your computer and use it in GitHub Desktop.
integer->encodeBase64Short, string->decodeBase64Short
This file contains hidden or 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
| /* | |
| 1: AQ | |
| 62: Pg | |
| 100: Z | |
| 1000: 6AM | |
| 10000: ECc | |
| 100000: oIYB | |
| 1000000: QEIP | |
| 10000000: gJaY | |
| 1000000000: AMqaOw | |
| 100000000000: AOh2SBc | |
| 100000000000000: AEB6EPN | |
| 9223372036854775807: /////////38 | |
| 18446744073709551615: //////////8 | |
| */ | |
| define integer->encodeBase64Short => { | |
| local(out) = bytes->import64bits(self) & encodebase64->asstring | |
| #out->removetrailing('=') & removetrailing('A') | |
| return #out | |
| } | |
| define string->decodeBase64Short => { | |
| return decode_base64(self + ('A' * (11 - self->size)) + '=')->export64bits | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment