Posted by fsvara on 17:27:00 02-14-2002
I want to implement a Base64 encoder/decoder for my irc plugin in C. Here is a good explanation of how Base64 encoding works:
http://hackingtruths.box.sk/base64.htm
Sadly, I have no idea how to do this... I *think* i could manage to get as far as having the bits of the three bytes appended... But then you have to "cut" that in 4 parts... I really don't know how to do that.
Anyway, that's how i'd put everything together: make two bitfields with 24bit. The first, bitfield0 will hold the result. Do bitfield1 = 'character'. Then, move the bits in bitfield1 16 positions to the left.
XOR bitfield0 with bitfield1.
Do bitfield1 = 'another character'. Move the bits in bitfield1 8 positions to the left. XOR bitfield0 with it again.
Continue with the process untill all three chars are merged into bitfield0...
Now, I dont have much expierience with such bit operations, and i dont know if that really works... besides, im stuck at that point
I'd be happy if you could help me!
thanks in advance.
Posted by KaGez on 14:21:00 02-15-2002
svara:
1.) I think the example shows it quite good... anyways...
2.) maybe you can use arrays? I forgot how you call those arrays... hashed arrays or something... I think those would be the lolution to go with
[addsig]
Posted by fsvara on 15:54:00 02-15-2002
actually, i think the eample show it extremely badly... well, i figured it out myself...
I wrote some short doc about it that i'll maybe enhance to become a tut or code snippet and i'll submit it...
it's here: http://z.dyndns.biz/documents/base64-enc