No GetPC(), requires ESI=EIP
Assemble with Yasm

bits 32
_b64decode:
addesi, b64decode_end - _b64decode
pushesi
popedi
b64_outer:
push4
lodsd
popecx
b64_inner:
roleax, 8
cmpal, '0'
jnbb64_testupr
shral, 2 ;because '+' and '/' differ by only 1 bit
xoral, '0' ;concatenate numbers and '+' and '/'
b64_testupr:
cmpal, 'A'
jnbb64_testlwr
addal, ('z' + 1) - '0' ;concatenate lowercase and numbers
b64_testlwr:
cmpal, 'a'
jbb64_store
subal, 'a' - ('Z' + 1) ;concatenate uppercase and lowercase
b64_store:
subal, 'A'
shrdebx, eax, 6
loopb64_inner
bswapebx
xchgebx, eax
stosd
cmpbyte [esi], '+'
decedi
jnbb64_outer
b64decode_end:
;append your base64 data here
;terminate with printable character less than '+'

Copyright (c) 2001, 2014 Peter Ferrie
All rights reserved

This site is hosted by 000webhost.com



Free web hostingWeb hosting