• Fuentes

 #478582  por Ninfrock
 29 Sep 2015, 09:45
Hola!

Le he agregado soporte para pass al NinfroCrypt
Function NinfroCrypt_Encrypt(Str As String, Key As String) As String
Dim Rn As String
Dim op As String
Dim i As Long
Dim k As Integer
k = 1
For i = 1 To Len(Str)
Randomize
Rn = Right(Rnd, 1)
op = op & Chr((Asc(Mid(Str, i, 1)) + Rn) Xor Asc(Mid(Key, k, 1))) & Chr(Rn Xor Asc(Mid(Key, k, 1))): k = k + 1
If k = Len(Key) + 1 Then k = 1
Next i
NinfroCrypt_Encrypt = op
End Function
Function NinfroCrypt_Decrypt(Str As String, Key As String) As String
Dim op As String
Dim i As Long
Dim k As Integer
k = 1
For i = 1 To Len(Str) Step 2
op = op & Chr((Asc(Mid(Str, i, 1)) Xor Asc(Mid(Key, k, 1))) - (Asc(Mid(Str, i + 1, 1)) Xor Asc(Mid(Key, k, 1)))): k = k + 1
If k = Len(Key) + 1 Then k = 1
Next i
NinfroCrypt_Decrypt = op
End Function
Saludos!