Esta funcion permite Encriptar y Desencriptar datos
'--> Esta funcion permite desencriptar datos que fueron encriptados con la funcion encripta. Public Function Decrypta(ByVal cTexto As String, ByVal nLlave As Integer) As String Dim nLargo As Long Dim n As Long Dim cCaracter As String Dim NewCadena As String Dim NewNumero As Long
For n = 1 To nLargo cCaracter = Chr(Asc(Mid(cTexto, n, 1)) - NewNumero) NewCadena = NewCadena & cCaracter Next Decrypta = NewCadena End Function
'--> Esta función combierte una cadena de caracteres en caracteres encriptados deacuerdo a una expreción númerica dada Public Function Encrypta(ByVal cTexto As String, ByVal nLlave As Integer) As String Dim nLargo As Long Dim n As Long Dim cCaracter As String Dim NewCadena As String Dim NewNumero As Long
On Error Resume Next nLargo = Len(cTexto) NewCadena = "" NewNumero = (nLlave / 256) * 4 For n = 1 To nLargo cCaracter = Chr(Asc(Mid(cTexto, n, 1)) + NewNumero) NewCadena = NewCadena & cCaracter Next Encrypta = NewCadena End Function