# Thread: Tutorial - Rot13/Rot-N Encryption

1. ## Tutorial - Rot13/Rot-N Encryption

- |Rot13/Rot-N Encryption Tutorial| -

What is Rot13 encryption?
Rot13 simple means rotating alphabet by 13 characters. It is a very primitive encryption method which can be easily decrypted on knowledge. But for a non-technical user it still remains an unsolved mystery. Rot13 encryption is very easy to understand and use. It is very similar to the Caesar-Encryption method. Here what we do is rotate the character backwards or front by 13 characters in the ASCII table. The means "a" becomes "n" and "p" becomes "}". This method has been used in many news delivery systems as to prevent third parties from gaining easy access to it in the past. But now there are many better encryption systems being used which remain hard to be decrypted. Rot13 uses very simple algorithms and the encryption/decryption functions can be easily made.

What is Rot-N encryption?
Rot13 and Rot-N are very similar with the only exception that Rot-N encryption rotates each character by any number of digit rather than 13. It is basically a number between 1 to 25 so it remains within the ASCII table.

Here is a simple visual basic function for encrypting/decrypting a string:-
Rot-13 was basically made only for typed characters and not any extra signs or special characters so trying characters like "?ot; would cause the program to fail. Anyways you can modify the function to fit all special characters too.

Visual Basic Functions:
VB Code:
`Public Function encrypt(strInput As String)    Dim n As Integer, i As Integer    n = 13    For i = 1 To Len(strInput)        Mid(strInput, i, 1) = Chr(Asc(Mid(strInput, i, 1)) + n)    Next i    encrypt = strInputEnd Function`
VB Code:
`Public Function decrypt(strInput As String)    Dim n As Integer, i As Integer    n = 13    For i = 1 To Len(strInput)        Mid(strInput, i, 1) = Chr(Asc(Mid(strInput, i, 1)) - n)    Next i    decrypt = strInputEnd Function`

The variable n specifies the number of characters with which it rotates.
Variable i is used to loop through each character and then rotate it n characters forward or backward.

To increase the strength of the encryption, you can further tweak the code a bit like reversing the string or converting every alternate character to Ucase and using numbers to enhance encryption.

Here is a sample program I made in Visual Basic 6 that clearly explains this method of encryption.

- Written By,
- Dayson Pais
- www.compzone.hhnf.com

Authors Name: Dayson Pais
Description: Rot13/Rot-N Encryption Tutorial
Level: Beginners
The code can be used and modified by anyone. I shall not be held responsible for any reflected offense.

2. ## Re: Tutorial - Rot13/Rot-N Encryption

The code/files within this thread (submitted: 6-17-2005) have been checked for malware by a moderator.

Disclaimer: This does not necessarily mean that any compiled files (DLL/EXE/OCX etc) are completely safe, but any supplied code does not contain any obvious malware. It also does not imply that code is error free, or that it performs exactly as described.

It is recommended that you manually check any code before running it, and/or use an automated tool such as Source Search by Minnow (available here or here).
If you find any serious issues (ie: the code causes damage or some sort), please contact a moderator of this forum.

Usage of any code/software posted on this forum is at your own risk.

3. ## Re: Tutorial - Rot13/Rot-N Encryption

Can you post the .vbproj file for this program? I run Visual Basic 2010 and your source files don't open in it. Please upload the .vbproj file for it. You can email it to me at: bharadwaj.raju777@gmail.com. Also, how did you make those 2-way text boxes? I just can't seem to figure it out. By the way, awesome program!

Thanks

#### 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