[VB.Net] String XOR

This XOR is slightly more useful, you can encrypt a string using a byte as the key:

    Public Function StringXOR(ByVal str1 As String, ByVal XORByte As Byte) As String
        StringXOR = ""
        For i As Integer = 0 To str1.Length - 1
            StringXOR &= CChar(ChrW(Asc(str1(i)) Xor XORByte))
    End Function


Debug.WriteLine(StringXOR("sim0n", 222))

Would Output:

and so

Debug.WriteLine(StringXOR("­•³î°", 222))

Would Output:


0 Responses to “[VB.Net] String XOR”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: