I've finally got round to making a Base64 decoder using the information from Base64 Decode Algorithm | Base64 Algorithm | Learn | Base64
It's very naive and takes 22 seconds to decode a 100x100 encoded image on my computer!
So, if anyone fancies improving it (no JS of course) I'd be really grateful
The final image should look like this (it's a tile of part of an earthnullschool.net wind map) but the decoder must decode the simple ones as well in order to be compliant
Username=cymplecy&ProjectName=base64
[edit Originally it was taking 300 secs but I'd made a mistake with encoding the data in the 1st place - all OK now - output bytes should be 40,000 long if processing the tile image]
And I don't need it myself at the moment but if someone fancies writing an encoder to go with it that would be very nice
With conversion 4 => 3 bytes "unrolled" as a single expression.
X mod 2^n - extract n low bits
X / 2^n - drop n low bits
X * 2 ^n - shift left n bit
Username=dardoro&ProjectName=base64%20decode
Wow
Actually does it in 679ms on mine
Now going thru it to make see how you've done it [edit - Done that - great idea not to have to convert to binary and then back again ]
Thank you very much
Compiled map makes it twice as fast on my computer
I've made a few cosmetic variable name changes, added padding if needed and made a custom reporter out of it.
[edit]Oct2023
added in an encoder
I've left the map un-compiled at the moment as I've sometimes had issues with compiled blocks
Thank you once again
Username=cymplecy&ProjectName=base64Decode
Although the new version
is twice as fast as the previous one, it still pales in comparison to JS
Because the complied version doesn't yield while its running, I'm not using it on large images
But I've added it as seperate block for anyone who wants to use it
system
Closed
June 30, 2022, 8:06pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
I've added an encoder as well
to go with the decoders
i put in a base 64 of an image and it did not decode it correctly
I'll look into it when i get back home later this week
nvm it was my personal error