Answer the question
In order to leave comments, you need to log in
How to encode numbers into characters?
There is data that consists of 12 digits.
0-9
, (comma)
- (minus)
Before sending to the server, I want to encode in A-Za-z0-9+characters.
This will reduce traffic.
How can it be encrypted and decrypted?
Maybe there are libraries? preferably in JavaScript
Answer the question
In order to leave comments, you need to log in
I know a tricky way!
1) Take and present the first set of characters as a NUMBER in the 12-decimal system (0-9+","+"-")
2) Count how many CHARACTERS you have in the new system (A-Za-z0-9+characters)
3) You transfer to the system with the specified base - obviously the number will be SHORT
4) You transfer, everything is back on the other side
PS. with strings of 12 digits, this will give a better result than options with standard frequency stop algorithms
base64 + optional GZIP. I would not bother with data compression at 12 bytes.
Encode numbers into characters, create an array of 12 characters, numbers 0-9 will be array indexes, well, minus with a comma there too. And to encrypt in js from a hacker, in my opinion, is useless. Anyone who wants to, will parse any obfuscated code. and for users it may be enough xor to do.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question