[TUT] ROT13 Encryption

Posts 1–5 of 5 · Page 1 of 1
[TUT] ROT13 Encryption
Hello, i thought i would share a method of encryption i have learnt in visual basic just to help out anyone who may be needing something like this

I found this code in my module library, if you paste that code into a command button it will work and will give you a rough idea of how the encryption works allowing you to use it other programs. In my full program I had this code encrypting a page full of data saving it to a text file which could be loaded up back into the program and decrypted again.

If anyone would like me to post the code of how to save the information to a text file and how to decrypt it then I would be more than happy to.


To start off declare your variables as either locals or globals

Code:
        '-------------------------------------------------------------------
        'Delcaring variables
        '-------------------------------------------------------------------
        Dim n As Integer, i As Integer
        Dim EnteredText As String
In your command button you will want to type out this code to get the program working correctly. Feel free to tweak the code to use other methods such as text boxes or whatever way you feel most comfortable.

Code:
        '-------------------------------------------------------------------
        'Rot 13 encryption
        '-------------------------------------------------------------------

        'Sets the change in Ascii characters
        n = 13

        'Sets the counter to 0
        i = 0

        'Instanciates the variable by making it equal to the entered text
        EnteredText = InputBox("Enter the string in which you wish to encrypt")

        'Encryption of the string
        For i = 1 To Len(EnteredText)
            Mid(EnteredText, i, 1) = Chr(Asc(Mid(EnteredText, i, 1)) + n)
        Next i

        MsgBox(EnteredText)
Basically the ROT13 method takes each character entered and moves it up 13 places on the ascii table making it unreadable. To decrypt it you just move each character in your encrypted string 13 places down the ascii table. Like i said above if anyone would like the saving and decryption posted just say below.

PS. Code will work in either VB6 or VB.NET

I am new to this site so criticism on how to make my tutorials better are greatly appreciated as I want people to actually learn from this and not just copy and paste

Thanks.
Note, ROT13 is a very week encryption, and the concept dates back to Ceasers Cipher.

However thank you for sharing.
Yes, it's pretty easy to decode with paper and a pen, altough if you don't have paper and pen you can always use some online websites with encrypters/ to encrypt/ and decrypters/ to decrypt/.(I think im making huge spelling mistakes here lol)

Ty anyways, I've created my own zenit-polar based encrypting language(not a computer one) that I use when i don't want some people to read certayn things I've in my computer or some people that might have access to my computer to find some stuff I also have in my computer ^.^
No, its not pornography.
Give credits.

And yes, as nextgen said, this is obviously a weak protection. Thanks for sharing.
Thanks for the replies i know its not a strong method of encryption I was just just hoping it would help beginners out
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us