I have a web form for the content of which I would like to create a short presentation in Base64. The form, by the way, contains a list of 264 binary values, most of which will be 0 at any given time. (They represent regions on a geographical map). Even in Base64, this 264-bit number generates a long, intimidating string. I want to implement full-length coding as efficiently as possible. can you help me with this? I searched for binary RLE but did not find anything useful.
What I have tried so far is running RLE in a binary string using decimal counters and "A" as a separator, indicating the change between 0 and 1, and then converting the result from base 11 to base 64. For example:
00000000001111111000000010000000000000000000000001111111110001111010101000000000000000000000000000000000000111111111110111000000000000111111100000001000000000000000000000000111111111000111101010100000000000000000000000000000000000011111111111011100
becomes
10A5A5AA22A7A1A2AAAAAAA34A9AA1A10A5A5AA22A7A1A2AAAAAAA34A9AA1A
which in turn becomes
CNnbr/FxkgbbOw0LNAKgk65P8SdvaTG+t74o
or, in base 62,
6imo7zq1pqr2mqglTHzXwJRAksm7fvHZHWQK
This is better, but I still can not doubt that I am doing something wrong - the number "A" is used, since the separator is the best way to do this?
And another update:
Thanks to @comingstorm, I cut the compressed line a bit more.
ILHHASCAASBYwwccDASYgAEgWDI=
As I mentioned in the comments, actual use cases usually result in an even shorter line.
source share