function | encryption Const sbase_64_characters = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/"
Function Base64Encode (ByVal ascontents)
Dim lnposition
Dim Lsresult
Dim Char1
Dim CHAR2
Dim CHAR3
Dim CHAR4
Dim Byte1
Dim Byte2
Dim Byte3
Dim SaveBits1
Dim SaveBits2
Dim lsgroupbinary
Dim LSGROUP64
If Len (ascontents) mod 3 > 0 Then ascontents = ascontents & String (3-(Len (ascontents) mod 3), ""
Lsresult = ""
For lnposition = 1 to Len (ascontents) Step 3
LSGROUP64 = ""
Lsgroupbinary = Mid (ascontents, lnposition, 3)
Byte1 = ASC (Mid (lsgroupbinary, 1, 1)): SaveBits1 = Byte1 and 3
Byte2 = ASC (Mid (Lsgroupbinary, 2, 1)): SaveBits2 = Byte2 and 15
Byte3 = ASC (Mid (Lsgroupbinary, 3, 1))
Char1 = Mid (Sbase_64_characters, (Byte1 and 252) \ 4) + 1, 1)
CHAR2 = Mid (Sbase_64_characters, (Byte2 and R) and &HFF) + 1, 1)
CHAR3 = Mid (Sbase_64_characters, (Byte3 and) Or (SAVEBITS2 * 4) and &HFF) + 1, 1)
CHAR4 = Mid (Sbase_64_characters, (Byte3 and 63) + 1, 1)
LSGROUP64 = Char1 & Char2 & Char3 & CHAR4
Lsresult = Lsresult + lsGroup64
Next
Base64Encode = Lsresult
End Function