.net encryption

Questions about programming languages and debugging
Post Reply
bubzuru
.net coder
.net coder
Posts: 700
Joined: 17 Apr 2007, 16:00
17
Contact:

.net encryption

Post by bubzuru »

this is a simple ascii swapping encryption technique in vb.net

Code: Select all

    Public Function SimpleCrypt(ByVal Text As String) As String
        Dim strTempChar As String = Nothing, i As Integer
        For i = 1 To Len(Text)
            If Asc(Mid$(Text, i, 1)) < 128 Then
                strTempChar = _
          CType(Asc(Mid$(Text, i, 1)) + 128, String)
            ElseIf Asc(Mid$(Text, i, 1)) > 128 Then
                strTempChar = _
          CType(Asc(Mid$(Text, i, 1)) - 128, String)
            End If
            Mid$(Text, i, 1) = _
                Chr(CType(strTempChar, Integer))
        Next i
        Return Text
    End Function
its not very safe but its still good for storing strings of
text in the registry etc :)

Code: Select all

 Dim boo As String
 boo = SimpleCrypt("booboo")
 MsgBox(boo)
        
 boo = SimpleCrypt(boo)
 MsgBox(boo)
[img]http://www.slackware.com/~msimons/slackware/grfx/shared/greymtlSW.jpg[/img]

Post Reply