Barre horizontale de naviagtion

lundi 21 mars 2011

Sécurité : XOR Encryption

    
'''
''' this function used to xor function char by char betwine data and key
'''

'''
'''
'''
'''
Private Shared Function XOREncryption(ByVal data As String, ByVal key As String) As String
Dim inSb As New StringBuilder(data)
Dim outSb As New StringBuilder(data.Length)
Dim c As Integer = 0
Dim key_count As Integer = 0
For i As Integer = 0 To data.Length - 1
c = AscW(inSb(i)) Xor AscW(key(key_count))
outSb.Append(ChrW(c))
If (key_count = key.Length) Then
key_count = 0
End If
Next
Return outSb.ToString()
End Function

Aucun commentaire:

Enregistrer un commentaire