Jue Mayo 24, 2012 9:13 am
Hola a todos, encontre estas funciones para encryptar y desencryptar una cadena en Opensc.
Aqui el codigo :)
Les dejo una pequeña aplicacion para que prueben las funciones.
Descarga:
[Tienes que estar registrado y conectado para ver este vínculo]
Saludos
Aqui el codigo :)
- Código:
Public Function EnCrypt(tSource As String, tPassword As String) As String
Dim iPassword As Integer
Dim iCrypt As Integer
Dim X As Integer
For X = 1 To Len(tPassword)
iPassword = iPassword + Asc(Mid$(tPassword, X, 1))
Next X
For X = 1 To Len(tSource)
iCrypt = Asc(Mid$(tSource, X, 1)) + iPassword + X
Do Until iCrypt <= 255
iCrypt = iCrypt - 255
Loop
EnCrypt = EnCrypt & Chr(iCrypt)
Next X
End Function
Public Function DeCrypt(tSource As String, tKey As String) As String
Dim iPassword As Integer
Dim iCrypt As Integer
Dim X As Integer
For X = 1 To Len(tKey)
iPassword = iPassword + Asc(Mid$(tKey, X, 1))
Next X
For X = 1 To Len(tSource)
iCrypt = Asc(Mid$(tSource, X, 1)) - iPassword - X
Do Until iCrypt > 0
iCrypt = iCrypt + 255
Loop
DeCrypt = DeCrypt & Chr(iCrypt)
Next X
End Function
Les dejo una pequeña aplicacion para que prueben las funciones.
Descarga:
[Tienes que estar registrado y conectado para ver este vínculo]
Saludos