我在MSN里下载了pb 的base64编码解码程序,好象有先问题
这个字符串 'C43FB772-4B68-4A43-9E87-7E4A3ABEBBAB' 编码完成后在进行解码操作以后,最后的单引号变成空格了,不知道怎么回事
------解决方案--------------------
我用的是pb9.03 8836,我记不得我后来有没有再改过,我电脑上保存的base64.pbl测试正常。
不过,我印象当中,的确是有问题,主要就是最后一位。
贴出我电脑上存的base64decode函数代码,你自己比较一下吧。
- C# code
//base64解密//参数说明://strbuf 待解密串//lc_return 回写解密后字符数组//返回解密后blobchar lch_base64key[64]blob lbl_returnlch_base64key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'if len(strbuf) = 0 then return lbl_returnif right(strbuf,1) = '=' then if left(right(strbuf,2),1) = '=' then strbuf = left(strbuf,len(strbuf) - 2) else strbuf = left(strbuf,len(strbuf) - 1) end ifend iflonglong ll_len,i,t,jll_len = len(strbuf) / 2string m[],xchar s1[2]long ll_loops,ll_strlenll_strlen = len(strbuf)IF ll_strlen > 6000 THEN IF Mod(ll_strlen, 6000) = 0 THEN ll_loops = ll_strlen/6000 ELSE ll_loops = (ll_strlen/6000) + 1 END IFELSE ll_loops = 1END IFlonglong ll_currentposll_currentpos = 1string ls_tmpfor j = 1 to ll_loops ls_tmp = mid(strbuf,ll_currentpos,6000) ll_currentpos += 6000 ll_len = len(ls_tmp) / 2 //转为十六进制字串 for i = 1 to ll_len s1 = mid(ls_tmp,i*2 - 1,2) t = (Pos(lch_base64key,s1[1]) - 1) * 64 + (Pos(lch_base64key,s1[2]) - 1) x = int2hex(t) if len(x) > 3 then m[j] += right(x,3) elseif len(x) = 2 then m[j] += '0'+x elseif len(x) = 1 then m[j] += '00'+x end if nextnextif mod(len(ls_tmp),2)=1 then t = (pos(lch_base64key,right(ls_tmp,1)) - 1) * 64 x = int2hex(t) if len(x) > 3 then m[ll_loops] += right(x,3) elseif len(x) = 2 then m[ll_loops] += '0'+x elseif len(x) = 1 then m[ll_loops] += '00'+x end if m[ll_loops] = left(m[ll_loops],len(m[ll_loops]) - 2)end ifchar lch_temp[]string ls_templl_currentpos = 0for j = 1 to upperbound(m) ll_len = len(m[j]) / 2 for i = 1 to ll_len ls_temp = mid(m[j],i*2 - 1,2) lch_temp[i+ll_currentpos] = char(hex2int(ls_temp)) next ll_currentpos += len(m[j]) / 2nextlc_return = lch_templbl_return = chararray2blob(lch_temp)//messagebox('',string(asc(lch_temp[upperbound(lch_temp)])))return lbl_return