Hola
Prueba con esta otra
Codificar
Código asp:
Ver originalDim Base64Chars
Base64Chars ="Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7IiJ8jKk9LlMmNnOoPpQqRrSsTtUuVvWwXxYyZz+/"
Public Function Codificar(byVal str)
Dim c1, c2, c3, w1, w2, w3, w4, i, strIn, strOut
strIn = Trim(str)
For i = 1 To Len(strIn) Step 3
c1 = Asc(Mid(strIn, i, 1))
c2 = Asc(Mid(strIn, i + 1, 1) + Chr(0))
c3 = Asc(Mid(strIn, i + 2, 1) + Chr(0))
w1 = Int(c1 / 4) : w2 = (c1 And 3) * 16 + Int(c2 / 16)
If Len(strIn) >= i + 1 Then
w3 = (c2 And 15) * 4 + Int(c3 / 64)
Else
w3 = -1
End If
If Len(strIn) >= i + 2 Then
w4 = c3 And 63
Else
w4 = -1
End If
strOut = strOut + aplCodificar(w1) + aplCodificar(w2) + aplCodificar(w3) + aplCodificar(w4)
Next
Codificar = strOut
End Function
Private Function aplCodificar(byVal intIn)
If intIn >= 0 Then
aplCodificar = Mid(Base64Chars, intIn + 1, 1)
Else
aplCodificar = ""
End If
End Function
Descodificar
Código asp:
Ver originalPublic Function DeCodificar(byVal str)
Dim w1, w2, w3, w4, i, strIn, strOut
strIn = Trim(str)
For i = 1 To Len(strIn) Step 4
w1 = aplDeCodificar(Mid(strIn, i, 1))
w2 = aplDeCodificar(Mid(strIn, i + 1, 1))
w3 = aplDeCodificar(Mid(strIn, i + 2, 1))
w4 = aplDeCodificar(Mid(strIn, i + 3, 1))
If w2 >= 0 Then strOut = strOut + Chr(((w1 * 4 + Int(w2 / 16)) And 255))
If w3 >= 0 Then strOut = strOut + Chr(((w2 * 16 + Int(w3 / 4)) And 255))
If w4 >= 0 Then strOut = strOut + Chr(((w3 * 64 + w4) And 255))
Next
DeCodificar = strOut
End Function
Private Function aplDeCodificar(byVal strIn)
If Len(strIn) = 0 Then
aplDeCodificar = -1 : Exit Function
Else
aplDeCodificar = InStr(Base64Chars, strIn) - 1
End If
End Function
Suerte