anyone have the sourcecode the a base64 converter? or can explain the algorithm?
nevermind i found it
Can you share the BASE64 code you found with me? I've been trying to develop it myself with little success. I have UUDecoding source if you need it. Xtreme
yes, i'll share it once i have implemented it. i'll do it when i wake up tomorrow, saturday. (should be around 14:00 CET, seeing as it is 05:00 now and im not sleeping yet)
to Zynaps n xtreme... could you guys also share your sources with me? elf+boi
Zynaps / elf+boi, This is really cool to finally get some B64 and UUDecoding sources working together. My question is, how do I determine, programatically, if the file being processed is B64 or UUD? Do I just look for the "BEGIN" and if its not found assume its B64? Xtreme
here it is, tested and everything.
maybe one of the asm wizards on this board could optimize it? :)
.data alphabet db "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" .code base64encode PROC source:DWORD, destination:DWORD, sourcelen:DWORD push edi push esi push ebx mov esi, source mov edi, destination @@base64loop: .IF sourcelen == 1 mov al, byte ptr and eax, 0FFh mov ecx, 2 ;bytes to output = 2 mov edx, 03D3Dh ;padding = 2 byte inc esi ;source ptr + 1 dec sourcelen ;length - 1 .ELSEIF sourcelen == 2 mov ax, word ptr and eax, 0FFFFh mov ecx, 3 ;bytes to output = 3 mov edx, 03Dh ;padding = 1 byte add esi, 2 ;source ptr + 2 sub sourcelen, 2 ;length - 2 .ELSE mov eax, dword ptr and eax, 0FFFFFFh mov ecx, 4 ;bytes to output = 4 xor edx, edx ;padding = 0 byte add esi, 3 ;source ptr + 3 sub sourcelen, 3 ;length - 3 .ENDIF xchg al,ah ; flip eax completely rol eax, 16 ; can this be done faster xchg al,ah ; ?? @@: push eax and eax, 0FC000000h ;get the last 6 high bits rol eax, 6 ;rotate them into al mov al, byte ptr ;get encode character stosb ;write to destination pop eax shl eax, 6 ;shift right 6 bits dec ecx jnz @B ;loop cmp sourcelen, 0 jnz @@base64loop ;main loop mov eax, edx ;add padding and null terminate stosd ; " " " " " pop ebx pop esi pop edi ret base64encode ENDP
do you also need a decoder? i haven't written that yet because i don't need it. but i might do it later if i get 1 or 2 requests ;)
Ok, i'll also write a decoder :)
Sure can try this, there is a intruction designed specifly for endian swapping:
xchg al,ah ; flip eax completely rol eax, 16 ; can this be done faster xchg al,ah ; ??
There u go, have a good one
a base64 decoder? sure! if it's alright with you though... elf+boi
already written it. gonna get them posted on the front page once i've written some example programs.