90 likes | 306 Views
Encryption Theory. CSC380 – Flint Joasaint, Marcial White. The Algorithm. RPG Program CCED01. Originally intended for 16 digit keys, We’ve extended it to 24 digits (A-Z). abcdefghijklmnopqrstuvwxyz bcdefghijklmnopqrstuvwxyza cdefghijklmnopqrstuvwxyzab defghijklmnopqrstuvwxyzabc
E N D
Encryption Theory CSC380 – Flint Joasaint, Marcial White
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…
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.
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
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
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);
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;}