flat assembler
Message board for the users of flat assembler.
Index
> Main > BASE64 |
Author |
|
Reverend 12 Feb 2007, 17:51
I've had BASE64 masm code on my homepage for some time, but it was just a transcription form C code, and thus just couldn't be really good. There were also some errors.
Finally I rewrote it from scratch. I post here both fasm and masm versions in attachment. There are 3 functions: base64_encode, base64_decode and base64_decode_fast. Two decoding functions, because the first one shares data table with encode func. and the other needs new table of 122 bytes - imho it's worth it, as the second function is significantly faster. Enjoy! EDIT: Newer version in the attachment: - fixed error when 0 was passed as size - option to put newline after each n-th character (for example, for MIME encoding) - only one decoding function (the faster one) - ignores characters from outside the decoding table
Last edited by Reverend on 12 Feb 2007, 19:26; edited 1 time in total |
|||||||||||
12 Feb 2007, 17:51 |
|
vid 12 Feb 2007, 18:01
base64 following which standard (there are more of them)?
supports padding? what does it do if someone passes length=0? supports breaking base64 data into multiple lines? ignores all characters on base64_decode, as defined in RFC 2045? |
|||
12 Feb 2007, 18:01 |
|
vid 12 Feb 2007, 18:27
glad to see you take it seriously. Think about how to report error from procedures (bad base64 data, zero length). If you make these procedures seriously working, i would like to include them to FASMLIB
Quote: no breaking into multiple lines (may add it as an option - TRUE/FALSE flag will change behaviour) rather add option for number of chars per line, no breaking if it's zero. |
|||
12 Feb 2007, 18:27 |
|
Reverend 12 Feb 2007, 19:30
New version is in the first, edited post.
As for the error reporting: - eax contains size of encoded/decoded data - so eax = 0 iff size = 0 - characters outside decoding table are not reported, they are just ignored. I'd be happy if it shows in FASMLIB |
|||
12 Feb 2007, 19:30 |
|
vid 12 Feb 2007, 19:35
Quote: - characters outside decoding table are not reported, they are just ignored. not all characters should be ignored, only some of them... |
|||
12 Feb 2007, 19:35 |
|
Reverend 12 Feb 2007, 19:54
"Additionally it specifies that any extra-alphabetic characters must be ignored by a compliant decoder" (quote from http://en.wikipedia.org/wiki/Base64)
It was about MIME encoding and generally that was what I wrote BASE64 for. |
|||
12 Feb 2007, 19:54 |
|
vid 12 Feb 2007, 20:29
you are right. But i find it pretty stupid
But do not take wikipedia as reliable source, you must use the RFC next time |
|||
12 Feb 2007, 20:29 |
|
r22 13 Feb 2007, 02:09
Vintage base64 encoding thread
http://board.flatassembler.net/topic.php?t=3063 The algorithm seems to run very fast on pentiums but it doesn't follow a standard implementation (input is null terminated string not sized buffer). But that can be easily changed. |
|||
13 Feb 2007, 02:09 |
|
f0dder 13 Feb 2007, 07:37
vid wrote: you are right. But i find it pretty stupid I agree 100% with vid on this. WikiPedia is a great resource and can be used for some initial research, but you shouldn't use use it as an exclusive source of information, and you should always practice source criticism. _________________ - carpe noctem |
|||
13 Feb 2007, 07:37 |
|
Reverend 13 Feb 2007, 14:47
vid, f0dder, I agree with both of you. And I do not take Wikipedia as a omniscient source
r22, thanks for reminding me of this thread. I even joined discussion then and forgot of it |
|||
13 Feb 2007, 14:47 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.