#module
#deffunc __initBase64
if fInitBase64:return
encodeTable="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
dim decodeTable,256/4 : memset decodeTable,128,256
repeat 26:poke decodeTable,'A'+cnt,cnt:loop
repeat 26:poke decodeTable,'a'+cnt,cnt+26:loop
repeat 10:poke decodeTable,'0'+cnt,cnt+52:loop
poke decodeTable,'+',62
poke decodeTable,'/',63
poke decodeTable,13,129
poke decodeTable,10,129
poke decodeTable,'=',254
poke decodeTable,0,255
fInitBase64=1
return
#defcfunc EncodeBase64 var src,int srclen
__InitBase64
mref destIndex,64
dest="":memexpand dest,(srclen+2)/3*4+(srclen+2)/3*4/76*2+1
srcIndex=0 : destIndex=0
repeat srclen/3
rdata=peek(src,srcIndex)<<16 | peek(src,srcIndex+1)<<8 | peek(src,srcIndex+2)
poke dest,destIndex,peek(encodeTable,rdata>>18)
poke dest,destIndex+1,peek(encodeTable,rdata>>12&63)
poke dest,destIndex+2,peek(encodeTable,rdata>>6&63)
poke dest,destIndex+3,peek(encodeTable,rdata&63)
srcIndex+=3 : destIndex+=4
if destIndex\78==76: poke dest,destIndex,"\n" : destIndex+=2
loop
if srclen\3>0{
rdata=peek(src,srcIndex)
poke dest,destIndex,peek(encodeTable,rdata>>2)
if srclen\3==1{
poke dest,destIndex+1,peek(encodeTable,rdata<<4&63)
wpoke dest,destIndex+2,0x3d3d ;'=='
}else{
rdata=(rdata&3)<<8 | peek(src,srcIndex+1)
poke dest,destIndex+1,peek(encodeTable,rdata>>4)
poke dest,destIndex+2,peek(encodeTable,rdata<<2&63)
poke dest,destIndex+3,'='
}
destIndex+=4
if destIndex\78==76: poke dest,destIndex,"\n" : destIndex+=2
}
poke dest,destIndex,0
return dest
#global
このモジュール(どこで拾ってきたっけ・・・)とNO.226153で解決しました hatterさん他ありがとうございます><