This variation of the Base64 encodeing sytem is slightly cheaper to code than the standard due to the rearranging of the values used.
6 bit input value | ASCII character range produced | gap |
0...9 | "0"..."9" | 30h, 48d, '0' |
10...35 | "A"..."Z" | 7, 'A'-':' |
36...61 | "a"..."z" | 6, 'a'-'[' |
62 | "+" | -80d, -50h, '+'-'{' |
63 | "?" | 20d, 14h, '?'-',' |
Encode 3 bytes into 4 bytes consisting of only the characters 0...9, A...Z, a...z, and +
Entry:
lodsd dec esi mov edx,eax mov ecx,4 .Repeat and al, 00111111y add al, ('0') .If al > '9' add al, ('A' - ':') .If al > 'Z' add al, ('a' - '[') .If al > 'z' .if al > 'z'+1 mov al, '?' .else mov al, '+' .EndIf .EndIf .EndIf .EndIf stosb shr edx, 6 mov al,dl .Untilcxz
Decode
get value .if al < 'a' .if al < 'A' .if al < '0' .if al == '+' mov al, 62 .else stc breakpoint .endif .elseif al > '9' .if al == '?' mov al, 63 .else stc breakpoint .endif .else ;0...9 sub al, '0' .endif .elseif al > 'Z' stc breakpoint .else ;A...Z sub al, 'A' - 10 .endif .elseif al > 'z' stc breakpoint .else ;a...z sub al, 'a' - 36 .EndIf
Better?
sub al, '0' .if Carry? .if al == '+' - '0' mov al, 62 .else breakpoint ;invalid character in Mime input stream .endif .else .if al > 9 sub al, 'A' - ':' ; if it was A, now its 10 .if Carry? .if al == '?' - ('A' - '0') mov al, 63 .else breakpoint ;invalid character in Mime input stream .endif .else .if al > 9 + 26 sub al, 'a' - '[' ; if it was a, now its 36 .if al > 9 + 26 + 26 breakpoint ;invalid character in Mime input stream .endif .endif .endif .endif .endif
file: /Techref/method/b64n.htm, 2KB, , updated: 2018/2/1 15:33, local time: 2024/12/22 12:52,
3.141.198.75:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/Techref/method/b64n.htm"> X86 Base64 Variant</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.