Encryption Theory

# Encryption Theory

Télécharger la présentation

## Encryption Theory

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Encryption Theory CSC380 – Flint Joasaint, Marcial White

2. The Algorithm RPG Program CCED01 Originally intended for 16 digit keys, We’ve extended it to 24 digits (A-Z) abcdefghijklmnopqrstuvwxyz bcdefghijklmnopqrstuvwxyza cdefghijklmnopqrstuvwxyzab defghijklmnopqrstuvwxyzabc efghijklmnopqrstuvwxyzabcd fghijklmnopqrstuvwxyzabcde ghijklmnopqrstuvwxyzabcdef hijklmnopqrstuvwxyzabcdefg ijklmnopqrstuvwxyzabcdefgh jklmnopqrstuvwxyzabcdefghi klmnopqrstuvwxyzabcdefghij lmnopqrstuvwxyzabcdefghijk mnopqrstuvwxyzabcdefghijkl nopqrstuvwxyzabcdefghijklm opqrstuvwxyzabcdefghijklmn pqrstuvwxyzabcdefghijklmno qrstuvwxyzabcdefghijklmnop rstuvwxyzabcdefghijklmnopq stuvwxyzabcdefghijklmnopqr tuvwxyzabcdefghijklmnopqrs uvwxyzabcdefghijklmnopqrst vwxyzabcdefghijklmnopqrstu Etc…

3. Algorithm Continued … Program CCED01 has only one parameter: a 25-byte character value. The first 24 bytes contain a left-justified letter. The last byte must contain E to encrypt or D to decrypt. CALL PGM (CCED01) PARM (‘Hello World E') Will yield “HDJKK QHJCT” CALL PGM (CCED01) PARM (‘HDJKK QHJCT D') Will decrypt the message.

4. Algorithm Continued For decryption … Input Letter H D J K K Q H J C T Array Element abcdefghijklmnopqrstuvwxyz bcdefghijklmnopqrstuvwxyza cdefghijklmnopqrstuvwxyzab defghijklmnopqrstuvwxyzabc efghijklmnopqrstuvwxyzabcd fghijklmnopqrstuvwxyzabcde ghijklmnopqrstuvwxyzabcdef hijklmnopqrstuvwxyzabcdefg ijklmnopqrstuvwxyzabcdefgh jklmnopqrstuvwxyzabcdefghi klmnopqrstuvwxyzabcdefghij Output Letter H E L L O W O R L D

5. The Interface

6. The Code public class simple{// Might randomize placement of characters in array laterstring[] characters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};string[] cypertext = {"!","@","#","\$","%",">","&","*","(",")","!","@","#","\$","%",">","&","*","(",")","&","*","(",")"};public simpleencrypt(){}public string EncryptString(string Data, string Key){if(Data.Length == 0)throw new ArgumentException("Hey Your key must be at please 1 digit.");uint[] formattedKey = FormatKey(Key);if(Data.Length%2!=0) Data += '\0'; byte[] dataBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(Data);string changedtext = string.Empty;uint[] tempData = new uint[2];for(int i=0; i

7. The Code, Cont… public class simple{// Might randomize placement of characters in array laterstring[] characters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};string[] cypertext = {"!","@","#","\$","%",">","&","*","(",")","!","@","#","\$","%",">","&","*","(",")","&","*","(",")"};public simpleencrypt(){} public string EncryptString(string Data, string Key){if(Data.Length == 0)throw new ArgumentException("Hey Your key must be at please 1 digit.");uint[] formattedKey = FormatKey(Key);

8. Code cont … if(Data.Length%2!=0) Data += '\0'; byte[] dataBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(Data);string changedtext = string.Empty;uint[] tempData = new uint[2]; for( int ix = 0; ix < data.Count; ++ix ){str = ( string )data[ ix ];sentences[ ix ] = str.Split( char );}changedtext += Util.ConvertUIntToString(tempData[0]) + Util.ConvertUIntToString(tempData[1]);}return changedtext;}