0% found this document useful (0 votes)
316 views

Vernam Cipher User Manual

This document describes a student project implementing the Vernam cipher for encrypting and decrypting plaintext. It includes the coding, pseudocode, user manual, and flow chart for the cipher. The coding uses a key to perform XOR operations on each character of the plaintext to generate the ciphertext. The pseudocode outlines the steps, including reading the plaintext as a string, retrieving characters using a pointer, performing XOR with key characters, and using a for loop to encrypt/decrypt the entire string. The user manual instructs the user to insert plaintext and see the encrypted text output. The flow chart shows the process of inputting plaintext, identifying it, encrypting it, and outputting the encrypted text.

Uploaded by

Ayung Raffie
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
316 views

Vernam Cipher User Manual

This document describes a student project implementing the Vernam cipher for encrypting and decrypting plaintext. It includes the coding, pseudocode, user manual, and flow chart for the cipher. The coding uses a key to perform XOR operations on each character of the plaintext to generate the ciphertext. The pseudocode outlines the steps, including reading the plaintext as a string, retrieving characters using a pointer, performing XOR with key characters, and using a for loop to encrypt/decrypt the entire string. The user manual instructs the user to insert plaintext and see the encrypted text output. The flow chart shows the process of inputting plaintext, identifying it, encrypting it, and outputting the encrypted text.

Uploaded by

Ayung Raffie
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Computer Security

Computer Security (DDC 3342) Semester 7 Sesi 2012/2013 Project Vernam Chiper

Nama IC No Tarikh Lecturer

: Muhammad Raffie Ag Apong : 910930-12-5145 : 03 October 2012 : Mdm Jusvinia Jerinius

Computer Security(DDC 3342)

Page 1

Computer Security
Content Coding Pseudocode User manual Flow Chart Executable program .. .. .. ..

Computer Security(DDC 3342)

Page 2

Computer Security
Coding
Public Class Form1 Dim CodeKey As String = "82938472" Private Sub PlainTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlainTextBox.TextChanged CipherRichTextBox.Clear() Dim DataIn As String = PlainTextBox.Text Dim Dim Dim Dim Dim Dim lonDataPtr As Long strDataOut As String temp As Integer tempstring As String intXOrValue1 As Integer intXOrValue2 As Integer

For lonDataPtr = 1 To Len(DataIn) 'The first value to be XOr-ed comes from the data to be encrypted intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1)) 'The second value comes from the code key intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1)) temp = (intXOrValue1 Xor intXOrValue2) tempstring = Hex(temp) 'If Len(tempstring) = 1 Then tempstring = "0" & tempstring tempstring = Convert.ToChar(Convert.ToUInt32(Integer.Parse(temp))) strDataOut = strDataOut + tempstring Debug.WriteLine(strDataOut) Next lonDataPtr CipherRichTextBox.Text = strDataOut End Sub

Private Sub CipherDRichTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CipherDRichTextBox.TextChanged PlainTRichTextBox2.Clear() Dim DataIn As String = CipherDRichTextBox.Text Dim Dim Dim Dim Dim Dim lonDataPtr As Long strDataOut As String temp As Integer tempstring As String intXOrValue1 As Integer intXOrValue2 As Integer

For lonDataPtr = 1 To Len(DataIn) 'The first value to be XOr-ed comes from the data to be encrypted intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1)) 'The second value comes from the code key intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1)) temp = (intXOrValue1 Xor intXOrValue2) tempstring = Hex(temp)

Computer Security(DDC 3342)

Page 3

Computer Security
'If Len(tempstring) = 1 Then tempstring = "0" & tempstring tempstring = Convert.ToChar(Convert.ToUInt32(Integer.Parse(temp))) strDataOut = strDataOut + tempstring Debug.WriteLine(strDataOut) Next lonDataPtr PlainTRichTextBox2.Text = strDataOut End Sub End Class

Computer Security(DDC 3342)

Page 4

Computer Security
Pseudocode

1. All the code can be executed automatically when inserting a plain text to the text box on the interface. For example I love Computer Security. 2.
We can read the entire plain text as one long string. For getting out each character of the plain text from the string we can use a pointer
Dim DataIn As String = PlainTextBox.Text Dim lonDataPtr As Long Dim strDataOut As String

3.
For getting out each character of the plain text from the string we can use a set up variables for storing the ASCII value of a character as well as each integer that will represent the cipher text and also using exclusive OR.
Dim Dim Dim Dim temp As Integer tempstring As String intXOrValue1 As Integer intXOrValue2 As Integer intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1)) 'The second value comes from the code key intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))

4. Next we prepare to write the cipher text into the file cipher.
Private Sub PlainTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlainTextBox.TextChanged CipherRichTextBox.Clear()

5. Finally, we employ for loop to call the function for encrypting the plain text. It is the same method for decrypting.
For lonDataPtr = 1 To Len(DataIn) 'The first value to be XOr-ed comes from the data to be encrypted intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1)) 'The second value comes from the code key intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1)) temp = (intXOrValue1 Xor intXOrValue2) tempstring = Hex(temp) 'If Len(tempstring) = 1 Then tempstring = "0" & tempstring tempstring = Convert.ToChar(Convert.ToUInt32(Integer.Parse(temp))) strDataOut = strDataOut + tempstring Debug.WriteLine(strDataOut) Next lonDataPtr

User Manual Computer Security(DDC 3342) Page 5

Computer Security
1. Insert a plain text to the text box. For an Example I Love Pc Security. 2. Then the text will automatically encrypt and appear to the encrypted text box at the bottom. 3. Repeat step 1 for decrypted plain text.

Plain text box

Encrypted text

Decrypted text

Flow Chart Computer Security(DDC 3342) Page 6

Computer Security

Inserting plain text

Yes No Identifying plain text

Yes

Encrypting plain text

Yes

Plain text encrypted

Computer Security(DDC 3342)

Page 7

You might also like