0

I'd like to find a way to shorten a thirteen-digit number while retaining its ability to be hand-typed. That is, I like a way to turn something like this: 2935497213884into this: mY==!2N. What would be the best way of doing this in Javascript? I looked into base64 encoding, and LZW compression, but most of the algorithms I found actually made the string longer instead of shorter.

I consider as hand-typable the characters: "ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz01234567890~`!@#$%^&*()-=_+[]{}|;:'",./<>?:"

Jonathan
  • 10,571
  • 13
  • 67
  • 103
  • Can you explain your question better? Why don't you just create a variable containing the value you want? – Tiago Marinho Sep 21 '14 at 19:52
  • How did you get to `mY==!2N`? What character set to you consider hand-typable? – Bergi Sep 21 '14 at 19:54
  • Why not use another base for numeral system (for example hexadecimal or numeral system with base 26 etc...) ? It will be easy to convert between two numeral systems. – Viktor Bahtev Sep 21 '14 at 20:01

1 Answers1

2

"large number array compression"

Example:

var test = [2935497213884]
alert(encodeNums(test))
alert(decodeNums(encodeNums(test)))

You can set hand-typable characters in 'encodable' variable.

Community
  • 1
  • 1
Wojciech Mleczek
  • 1,574
  • 15
  • 18