758 posts
Location
Budapest, Hungary
Posted 08 October 2013 - 03:50 PM
Yeah, that. Base64 encoding and decoding. It's useful when one wants to save binary data, because CC can't distinguish the CR (0x0D) from the LF (0x0A) character. (To be honest, I was bored.)
Remember, this is not any kind of encryption or hashing. This is just an awesome way of converting three octets into four printable characters.
For the ones who don't know what Base64 is.And for the ones who actually would like to use this (pastebin get rsd5qnEW base64).EDIT: Updated code on Pastebin.
Edited on 09 April 2014 - 02:17 PM
756 posts
Posted 08 October 2013 - 04:31 PM
That's nice, but it seems like you forgot to define "base64Chars" and "base64Values".
I get this error upon encoding : "7: attempt to index ? (a nil value)"
and this one when decoding : "19: attempt to index ? (a nil value)"
2217 posts
Location
3232235883
Posted 08 October 2013 - 11:00 PM
https://gist.github....iller64/6895559i got bored, and decided to make one that was a bit more optimized
warning, cluster%^&* code
o=o..string.char((_unb64[txt:sub(l1,l1)]*4)+math.floor(d1/16),((d1%16)*16)+math.floor(d2/4),((d2%4)*64)+_unb64[txt:sub(l1+3,l1+3)])
use it if you want :P/>
758 posts
Location
Budapest, Hungary
Posted 09 October 2013 - 12:14 AM
Holy cow, I indeed did! Thing is, I was writing some kind of an encryption API. The daclarations are the first few lines of that and I copied over only the relevant functions :P/> Sorry…
Updated code on pastebin.
758 posts
Location
Budapest, Hungary
Posted 09 April 2014 - 04:20 PM
*sigh* I found this thread yesterday, and what I saw made me flinch (the code; oh, the horror). So, yeah, I've uploaded a way better implementation of the Base64 method. Same Pastebin ID; edited OP.
1610 posts
Posted 09 April 2014 - 04:53 PM
*sigh* I found this thread yesterday, and what I saw made me flinch (the code; oh, the horror). So, yeah, I've uploaded a way better implementation of the Base64 method. Same Pastebin ID; edited OP.
It's like looking at baby pictures :P/>
And finally, a useful necro :D/>