<% function Base64Encode(str) b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" For IB = 1 To Len(str) Step 3 if Mid(str, IB + 1, 1) = "" then N1 = 0 else N1 = asc(Mid(str, IB + 1, 1)) if Mid(str, IB + 2, 1) = "" then N2 = 0 else N2 = asc(Mid(str, IB + 2, 1)) T = &H10000 * Asc(Mid(str, IB, 1)) + &H100 * N1 + N2 T = Oct(T) T = String(8 - Len(T), "0") & T s = Mid(b64, CLng("&o" & Mid(T, 1, 2)) + 1, 1) + Mid(b64, CLng("&o" & Mid(T, 3, 2)) + 1, 1) s = s + Mid(b64, CLng("&o" & Mid(T, 5, 2)) + 1, 1) + Mid(b64, CLng("&o" & Mid(T, 7, 2)) + 1, 1) Base64Encode = Base64Encode + s Next L = 3 - ( len(str) mod 3 ) if L < 3 then Base64Encode = Left(Base64Encode , len(Base64Encode) - L) & string(L,"=") end function %> <% function Base64Decode(str) b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" for start = 1 to len(str) step 4 db = 3 n = 0 for b = 0 to 3 c = mid(str,b+start,1) if c="=" then db = db-1 d = 0 else d = instr(b64,c)-1 end if if d = -1 then exit function n = 64*n+d next n = hex(n) n = string(6 - len(n),"0") & n out = chr(CByte("&H"&mid(n,1,2))) & chr(CByte("&H"&mid(n,3,2))) & chr(CByte("&H"&mid(n,5,2))) Base64Decode = Base64Decode & left(out,db) next end function %>