Welcome to www.programmer2programmer.net Its all about security programming source code


 Microsoft Certification
 Final Year Project Idea
 Connection Strings
 Password Recovery
 SQL Injection
 Encryption & Decryption
 LIVE Academic Project
 Project #1 - VB6, Access
  Project #2 - VB.Net, SQL
 Project #3 - ASP, Access
 Project #4 - ASP.NET, C#
 Project #5 - VB6, SQL
 Project #6 - Stegano
 Project #7 - C
 Project #8 - C++
 Project #9 - JAVA, MySQL
 Project #10- PHP, MySQL
 Project #11- JSP, Oracle
 Project #12- C# Face Exp
 Project #13- Mobile Bank
 Download MBA Project
 MBA Project Topic
 Project Viva Question
  2015 New Projects
 Project Synopsis Download
 University Question Paper and Assignment
 SMU - Question Paper
 SMU - Assignment
 SCDL - Assignment
 Interview Question Answer
 General & HR Round
 Visual Basic 6
 VB.Net & C#
 SQL Server
  Oracle and DBA

100% Tested
Ready Academic IT Projects


 XOR Encryption, Vernam Cipher Logics, Sample Coding, Text and Database Encryptr by XOR Encryption

Home Personal Member Forum Source Project Tips Contact

Encryption and Decryption

XOR Encryption

1. Encryption / Decryption


The simplest stream cipher is called the Vernam cipher or XOR Encryption. A bit from a key is added, with the carry discarded, to a bit from the plaintext to yield one bit of cipher text (this operation is called exclusive -OR). One simple way to encrypt and decrypt data is using XOR Encryption method, The character in the data stream and those of a code key are XORed together to create and encrypted character. The process is exactly same for encryption as well as decryption.

The code key can be made up of any alphanumeric characters you want. It can be any long, much longer key used it is most tough to crack.

2. XOR Encryption
3. Transposition Encryption
4. Symmetric Encryption
5. Asymmetric Encryption
6. Certificate Authority
7. Decryption Logics
8. Sample Coding

Vernam or XOR Ciphers turn out to be easy to break. An attack can mathematically combine ciphertext messages in pairs to factor out the key stream and produce a messages that is easier to crack. If the attacker solves one message, extracting its plaintext from ciphertext, the plaintext from ciphertext, that plaintext can be used to create the key string. Once the key string is recovered, the attacker can decipher all of the other messages protected with that key string.

Despite its weakness in simple applications, the XOR Encryption remains an important cipher, It is weak when we use repeating keys, but it can be very effective when the key stream varies continuously. this approaches is often uses in modern stream ciphers RC4 (Rivest Cipher #4), developed by Ron Rivest of RSA data security. It is used wisely in the field of data security for its easy to use, however it is very easy to crack for professional hacker.

XOR Encryption is not very secure and it can be crack very easily, however if want encrypt messages or documents so that the cannot be viewed in text editor, then it is simple way to accomplish.

Following code demonstrate how to use XOR Encryption algorithm to encrypt and decrypt a stream of text with Key Code, here we are creating a function named XORCipher which take two argument one is Input stream and one is Key code.

We XORed each bit of stream with the Key bit and concatenate the resulting bit to produce return string, it used same function to encryption and decryption, however in both case the key code should be same.

    Public Function XORCipher(ByVal strDataIn As String, _

    ByVal CodeKey As Integer) As String

        Dim i As Integer

        Dim j As Long

        Dim StrOut As String

        StrOut = ""

        For j = 1 To Len(strDataIn)

            i = Asc(Mid(strDataIn, j, 1)) Xor CodeKey

            StrOut = StrOut & Chr(i)


        XORCipher = StrOut

    End Function

For example if we call the function XORCipher("ATANU MAITY",160) then it returns cipher text "áôáîõ€íáéôù", same way if we call the function XORCipher("áôáîõ€íáéôù",160) then it returns plain text "ATANU MAITY".

For completing listing of the code and sample Visual Basic 6 project for XOR Encryption can be found in Sample Code section.

Next 3.  Transposition Encryption
(C) Atanu Maity, 2006-2015