请问将BASE64编码字串解码?
本文导语: 怎么实现?什么函数? | 脚本实现的,不知道可以帮你吗? OPTION EXPLICIT const BASE_64_MAP_INIT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" dim nl dim Base64EncM...
|
OPTION EXPLICIT
const BASE_64_MAP_INIT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
dim nl
dim Base64EncMap(63)
dim Base64DecMap(127)
PUBLIC SUB initCodecs()
nl = "
" & chr(13) & chr(10)
dim max, idx
max = len(BASE_64_MAP_INIT)
for idx = 0 to max - 1
Base64EncMap(idx) = mid(BASE_64_MAP_INIT, idx + 1, 1)
next
for idx = 0 to max - 1
Base64DecMap(ASC(Base64EncMap(idx))) = idx
next
END SUB
PUBLIC FUNCTION base64Encode(plain)
if len(plain) = 0 then
base64Encode = ""
exit function
end if
dim ret, ndx, by3, first, second, third
by3 = (len(plain) 3) * 3
ndx = 1
do while ndx