ROT_13 Crypter/Decrypter Module-VBForums
Results 1 to 4 of 4

Thread: ROT_13 Crypter/Decrypter Module

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    202

    ROT_13 Crypter/Decrypter Module

    The Module is by me. Here the wikipedia Article: http://en.wikipedia.org/wiki/ROT13

    Hatte mal bisschen Freizeit und habe dann das Module geschrieben.

    Here the Executeable(Commandline):

    http://rapidshare.com/files/294783120/ROT_13.rar

    If the String you want to Crypt have Spaces then you need to insert quotes(""). Example:
    ROT_13 crypt "Hello World"

    Here then Source:

    Code:
    '
    'ROT_13 Crypt/Decrypt Module
    'by alexj.
    '© 2009
    '
    '
    
    Module ROT_13
    
           Public Shared Function ROT13(ByVal input As String) As String
            Dim bData() As Byte = Encoding.ASCII.GetBytes(input)
            Dim bUKey(25) As Byte
            Dim bLKey(25) As Byte
    
            For i As Byte = 0 To 25
                bUKey(i) = 65 + ((i + 13) Mod 26)
                bLKey(i) = 97 + ((i + 13) Mod 26)
            Next
    
            For j As Integer = 0 To (bData.Length - 1)
                Select Case bData(j)
                    Case 65 To 91
                        bData(j) = bUKey(bData(j) - 65)
                    Case 97 To 122
                        bData(j) = bLKey(bData(j) - 97)
                    Case Else
                        bData(j) = 32 ' space
                End Select
            Next
    
            Return Encoding.ASCII.GetString(bData)
        End Function
    End Module
    Last edited by alexjanjic; Oct 20th, 2009 at 11:57 AM.

  2. #2
    Addicted Member
    Join Date
    Jun 2008
    Location
    Macedonia
    Posts
    188

    Re: ROT_13 Crypter/Decrypter Module

    Interestic crypter.
    MACEDONIA 4EVER

  3. #3
    Hyperactive Member gooden's Avatar
    Join Date
    Dec 2006
    Location
    Portugal
    Posts
    274

    Re: ROT_13 Crypter/Decrypter Module

    You forgot the decrypt

    vb Code:
    1. Imports System.Text
    2. Module ROT_13
    3.  
    4.     Public Function Crypt(ByVal input As String) As String
    5.         Dim bData() As Byte = Encoding.ASCII.GetBytes(input)
    6.         Dim bUKey(25) As Byte
    7.         Dim bLKey(25) As Byte
    8.  
    9.         For i As Byte = 0 To 25
    10.             bUKey(i) = 65 + ((i + 13) Mod 26)
    11.             bLKey(i) = 97 + ((i + 13) Mod 26)
    12.         Next
    13.  
    14.         For j As Integer = 0 To (bData.Length - 1)
    15.             Select Case bData(j)
    16.                 Case 65 To 91
    17.                     bData(j) = bUKey(bData(j) - 65)
    18.                 Case 97 To 122
    19.                     bData(j) = bLKey(bData(j) - 97)
    20.                 Case Else
    21.                     bData(j) = 32 ' space
    22.             End Select
    23.         Next
    24.  
    25.         Return Encoding.ASCII.GetString(bData)
    26.     End Function
    27.     Public Function Decrypt(ByVal ROT_13CryptedText As String) As Object
    28.         Dim str As String = String.Empty
    29.         Dim str2 As String = ROT_13CryptedText
    30.         Dim num As Integer = 0
    31.         Dim length As Integer = str2.Length
    32.         Do While (num < length)
    33.             Dim ch As Char = str2.Chars(num)
    34.             Select Case Asc(ch.ToString)
    35.                 Case 65 To 91
    36.                     If Asc(ch.ToString) > 77 Then
    37.                         str = str & Chr(Asc(ch.ToString) - 13).ToString
    38.                     Else
    39.                         str = str & Chr(Asc(ch.ToString) + 13).ToString
    40.                     End If
    41.                 Case 97 To 122
    42.                     If Asc(ch.ToString) > 109 Then
    43.                         str = str & Chr(Asc(ch.ToString) - 13).ToString
    44.                     Else
    45.                         str = str & Chr(Asc(ch.ToString) + 13).ToString
    46.                     End If
    47.                 Case Else
    48.                     str = str & " "
    49.             End Select
    50.             num += 1
    51.         Loop
    52.         Return str
    53.     End Function
    54. End Module
    Last edited by gooden; Oct 20th, 2009 at 02:36 PM.


    The Future Is Always The Way To Live The Life

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    202

    Re: ROT_13 Crypter/Decrypter Module

    Quote Originally Posted by gooden View Post
    You forgot the decrypt

    vb Code:
    1. Imports System.Text
    2. Module ROT_13
    3.  
    4.     Public Function Crypt(ByVal input As String) As String
    5.         Dim bData() As Byte = Encoding.ASCII.GetBytes(input)
    6.         Dim bUKey(25) As Byte
    7.         Dim bLKey(25) As Byte
    8.  
    9.         For i As Byte = 0 To 25
    10.             bUKey(i) = 65 + ((i + 13) Mod 26)
    11.             bLKey(i) = 97 + ((i + 13) Mod 26)
    12.         Next
    13.  
    14.         For j As Integer = 0 To (bData.Length - 1)
    15.             Select Case bData(j)
    16.                 Case 65 To 91
    17.                     bData(j) = bUKey(bData(j) - 65)
    18.                 Case 97 To 122
    19.                     bData(j) = bLKey(bData(j) - 97)
    20.                 Case Else
    21.                     bData(j) = 32 ' space
    22.             End Select
    23.         Next
    24.  
    25.         Return Encoding.ASCII.GetString(bData)
    26.     End Function
    27.     Public Function Decrypt(ByVal ROT_13CryptedText As String) As Object
    28.         Dim str As String = String.Empty
    29.         Dim str2 As String = ROT_13CryptedText
    30.         Dim num As Integer = 0
    31.         Dim length As Integer = str2.Length
    32.         Do While (num < length)
    33.             Dim ch As Char = str2.Chars(num)
    34.             Select Case Asc(ch.ToString)
    35.                 Case 65 To 91
    36.                     If Asc(ch.ToString) > 77 Then
    37.                         str = str & Chr(Asc(ch.ToString) - 13).ToString
    38.                     Else
    39.                         str = str & Chr(Asc(ch.ToString) + 13).ToString
    40.                     End If
    41.                 Case 97 To 122
    42.                     If Asc(ch.ToString) > 109 Then
    43.                         str = str & Chr(Asc(ch.ToString) - 13).ToString
    44.                     Else
    45.                         str = str & Chr(Asc(ch.ToString) + 13).ToString
    46.                     End If
    47.                 Case Else
    48.                     str = str & " "
    49.             End Select
    50.             num += 1
    51.         Loop
    52.         Return str
    53.     End Function
    54. End Module
    I didnt Crypting and Decrypting is the same Function

    If it crypts A to N and later you use again the Function N is converted to A

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.