Sergio01 de Abril del 2003
Pregunta
Buenas,
Me gustaría saber alguna forma sencilla y fiable (por ejemplo, mediante una función) de encriptar una contraseña para guardarla posteriormente en una BD de Access. Si alguien pudiera proporcionarme el código le estaría muy agradecido. Un saludo
ROGELIO01 de Abril del 2003
Function Encriptar(ByVal strClave As String, ByVal strPass As String) As String
Dim strEncClave As String
Dim intTemp As Integer
Dim intLenClave As Integer
Dim intLenPass As Integer
Dim i As Integer 'Contador de Password
Dim j As Integer 'Contador de clave
intLenClave = Len(strClave)
intLenPass = Len(strPass)
j = 1
For i = 1 To intLenPass
intTemp = Asc(Mid(strClave, j, 1)) - Asc(Mid(strPass, i, 1))
If intTemp < 32 Then
intTemp = 122 - (32 - intTemp)
End If
If intTemp > 122 Then
intTemp = 32 + (intTemp - 122)
End If
strEncClave = strEncClave & Chr(intTemp)
j = j + 1
If j > intLenClave Then j = 1
Next i
Encriptar = strEncClave
End Function
Function Desencriptar(ByVal strClave As String, ByVal strPass As String) As String
Dim strEncClave As String
Dim intTemp As Integer
Dim intLenClave As Integer
Dim intLenPass As Integer
Dim i As Integer 'Contador de Password
Dim j As Integer 'Contador de clave
intLenClave = Len(strClave)
intLenPass = Len(strPass)
j = 1
For i = 1 To intLenPass
intTemp = Asc(Mid(strClave, j, 1)) - Asc(Mid(strPass, i, 1))
If intTemp < 32 Then
intTemp = 122 - (32 - intTemp)
End If
If intTemp > 122 Then
intTemp = 32 + (intTemp - 122)
End If
strEncClave = strEncClave & Chr(intTemp)
j = j + 1
If j > intLenClave Then j = 1
Next i
Desencriptar = strEncClave
End Function
efra01 de Abril del 2003
Hay un codigo en ASP que te permite encriptar lo que sea basado en el algorito MD5, lo tengo pero no recuerdo donde se baja, mandame tu mail y te envio con gusto.