- WELCOME TO A LESSON ON HOW TO USE A CAESAR CIPHER
WITH A SHIFT TO ENCRYPT AND DECRYPT A MESSAGE.
BOTH THE SUBSTITUTION AND TRANSPOSITION METHODS
DISCUSSED SO FAR ARE SHARED SYMMETRIC KEY METHODS
MEANING THAT BOTH SENDER AND RECEIVER
WOULD HAVE TO HAVE AGREED UPON THE SAME SECRET ENCRYPTION KEY
BEFORE ANY MESSAGES COULD BE SENT.
ALL THE METHODS SO FAR HAVE BEEN SUSCEPTIBLE
TO FREQUENCY ANALYSIS SINCE EACH LETTER
IS ALWAYS MAPPED TO THE SAME ENCRYPTED CHARACTER.
MORE DETAILED METHODS GET AROUND THIS WEAKNESS.
FOR EXAMPLE, THE ENIGMA MACHINES USED IN WORLD WAR II
HAD WHEELS THAT ROTATED.
EACH WHEEL WAS A SUBSTITUTION CIPHER BUT THE ROTATION
WOULD CAUSE THE SUBSTITUTION
USED TO SHIFT AFTER EACH CHARACTER
AND THEREFORE REDUCING THE RISK OF FREQUENCY ANALYSIS.
FOR A SIMPLIFIED EXAMPLE IN THE INITIAL SET UP,
THE WHEEL MIGHT PROVIDE THE MAPPING GIVEN HERE.
NOTICE HOW WE'RE MAPPING THE ENTIRE ALPHABET
AS WELL AS THE NUMBERS 0 THROUGH 9.
NOTICE "A" MAPS TO D, B MAPS TO E, F MAPS TO C AND SO ON.
SINCE D IS THREE POSITIONS TO THE RIGHT OF "A,"
NOTICE HOW THIS WOULD BE A SHIFT 3.
HOWEVER, AFTER THE FIRST CHARACTER IS ENCRYPTED,
THE WHEEL ROTATES SHIFTING THE MAPPING
ONE SPACE RESULTING IN A NEW SHIFTED MAPPING.
SO IF THE MAPPING SHIFTS ONE MORE POSITION,
WE CAN THINK OF THIS RED ROW AS SHIFTING ONE UNIT
IN THIS DIRECTION.
IF THAT HAPPENED, NOTICE HOW NOW "A" WOULD NO LONGER MAP TO D,
"A" WOULD MAP TO E, B WOULD MAP TO F
AND SO ON WHICH IS SHOWN IN THIS MAPPING HERE.
USING THIS APPROACH, NO LETTER GETS ENCRYPTED
AS THE SAME CHARACTER OVER AND OVER AGAIN.
LET'S TAKE A LOOK AT AN EXAMPLE.
WE WANT TO ENCRYPT THE WORD CORD
USING AN ALPHABETIC CESAR SHIFT CIPHER
THAT STARTS WITH A SHIFT OF TWO MAPPING "A" TO C
AND SHIFTS ONE ADDITIONAL SPACE
AFTER EACH CHARACTER IS ENCRYPTED.
NOTICE HOW THIS FIRST MAPPING SHOWS A SHIFT OF TWO,
"A" IS MAPPED TO C, B IS MAPPED TO D,
C IS MAPPED TO E AND SO ON.
SO WE'LL USE THIS MAPPING ONLY FOR THE FIRST LETTER OF C.
SO NOTICE THAT C MAPS TO E, SO OUR FIRST ENCRYPTED LETTER IS E.
BEFORE WE ENCRYPT THE NEXT LETTER OF O,
WE'LL MAKE A SHIFT OF ONE MORE POSITION.
SO WE CAN THINK OF MOVING THIS ROW HERE
ONE POSITION TO THE LEFT WHICH MEANS
NOW "A" WOULD NO LONGER MAP TO C,
"A" WOULD MAP TO D, B WOULD MAP TO E,
C WOULD MAP TO F AND SO ON
WHICH IS ALREADY SHOWN IN THE SECOND MAPPING.
SO WE'LL USE THIS MAPPING FOR THE LETTER O,
SO O WOULD MAP TO R.
NOW IT DOES GET TIME CONSUMING TO MAKE
THESE NEW MAPPINGS EVERY TIME
SO LET'S MAKE ADJUSTMENTS TO THIS MAPPING
FOR THE LAST THREE LETTERS.
WE WOULD NOW SHIFT THIS ONE POSITION
AND NOW WE CAN ENCRYPT THE NEXT LETTER OF U
SO BEFORE U MAPPED TO X, BUT NOW WITH THE EXTRA SHIFT,
U WOULD MAP TO Y.
SO THE NEXT ENCRYPTED LETTER WOULD BE Y.
WE'D SHIFT THIS ONE MORE POSITION
AND THEN FIND THE MAPPING FOR R, WHICH MEANS FOR R,
WE'LL MAP THIS TWO MORE ADDITIONAL POSITIONS
TO THE RIGHT SO R WOULD MAP TO W.
AND THEN FOR THE FINAL LETTER, T,
WE WOULD SHIFT THIS ONE MORE POSITION
AND THEREFORE USING THIS MAPPING
T WOULD ACTUALLY MAP THREE MORE POSITIONS TO THE RIGHT
SO T WOULD ACTUALLY MAP TO Z.
THIS WOULD BE THE ENCRYPTION FOR THE WORD COURT.
NOW LET'S TAKE A LOOK AT AN EXAMPLE
IN THE OPPOSITE DIRECTION.
LET'S DECRYPT THIS WORD.
IF IT WAS ENCRYPTED USING AN ALPHABETIC CAESAR SHIFT CIPHER,
THAT STARTED WITH A SHIFT OF 14, MAPPING "A" TO O,
AND THEN SHIFTS ONE ADDITIONAL SPACE AFTER EACH CHARACTER
IS ENCRYPTED.
SO THIS FIRST MAPPING MAPS "A" TO O AS DESCRIBED.
THIS WOULD ONLY BE THE MAPPING FOR THE FIRST LETTER OR Z.
SO TO DECRYPT THIS, WE WOULD FIND THE RED Z WHICH IS HERE,
AND THEREFORE Z WOULD DECRYPT TO L.
SO THE FIRST LETTER WOULD BE L
AND NOW THIS WOULD HAVE BEEN SHIFTED ONE POSITION
IN THIS DIRECTION AND THEREFORE L WOULD NO LONGER MAP TO Z,
L WOULD NOW MAP TO "A" WHICH WE SEE HERE IN THIS SECOND MAPPING.
SO WE'LL USE THIS MAPPING FOR THE SECOND LETTER T.
SO IF THE ENCRYPTED LETTER WAS T,
NOTICE HOW THE ORIGINAL LETTER WOULD HAVE BEEN E.
INSTEAD OF CREATING A NEW MAPPING EACH TIME,
LET'S ADJUST THIS MAPPING FOR THE NEXT THREE LETTERS.
SO BEFORE DECRYPTING Q,
WE WOULD SHIFT THIS ONE POSITION,
THEREFORE E WOULD NO LONGER MAP TO T, E WOULD MAP TO U.
SO TO DECRYPT Q, Q WOULD ACTUALLY DECRYPT TO "A."
THE NEXT LETTER IS J, SO BEFORE DECRYPTING J,
WE WOULD SHIFT THIS ONE MORE POSITION
SO HERE'S J, INSTEAD OF DECRYPTING TO T,
WE'D ACTUALLY DECRYPT TO S.
NOW WE'D SHIFT THIS ONE MORE POSITION AND DECRYPT L.
AND BECAUSE WE'VE SHIFTED THE POSITION ONCE THREE TIMES,
L, THIS ENCRYPTED CHARACTER HERE,
WOULD DECRYPT TO ONE, TWO, THREE TO T.
SO THE ORIGINAL MESSAGE WAS THE WORD LEAST.
THE ACTUAL ENIGMA MACHINES USED IN WORLD WAR II
WERE MORE COMPLEX THAN OUR EXAMPLES.
EACH WHEEL CONSISTED OF A COMPLEX SUBSTITUTION CIPHER
AND MULTIPLE WHEELS WERE USED IN A CHAIN.
THE SPECIFIC WHEELS USED,
ORDER OF THE WHEELS AND THE STARTING POSITIONS OF THE WHEELS
FORMED THE ENCRYPTION KEY.
WHILE CAPTURED ENIGMA DEVICES
PROVIDED THE ALLIED FORCES DETAILS
ON THE ENCRYPTION METHOD,
THE KEYS STILL HAD TO BE BROKEN TO DECRYPT MESSAGES.
THESE CODE BREAKING EFFORTS LED TO THE DEVELOPMENT
OF SOME OF THE FIRST ELECTRONIC COMPUTERS BY ALAN TURING
AT BLETCHLEY PARK IN THE UNITED KINGDOM.
THIS IS GENERALLY CONSIDERED THE BEGINNING OF MODERN COMPUTING.
IN THE 1970s THE U.S. GOVERNMENT HAD A COMPETITION
AND ULTIMATELY PROVIDED AN ALGORITHM
DEEMED DES FOR DATA ENCRYPTION STANDARD
TO BE USED FOR ENCRYPTING GOVERNMENT DATA.
IT BECAME THE STANDARD ENCRYPTION ALGORITHM USED.
THIS METHOD USED A COMBINATION OF MULTIPLE SUBSTITUTION
AND TRANSPOSITION STEPS ALONG WITH OTHER STEPS
IN WHICH THE ENCRYPTION KEY IS MIXED WITH THE MESSAGE.
THIS METHOD USES AN ENCRYPTION KEY WITH LENGTH 56 BITS
MEANING THERE WERE TWO TO THE 56 POWER POSSIBLE KEYS.
THIS NUMBER OF KEYS MAKES A BRUTE FORCE ATTACK
EXTREMELY DIFFICULT AND COSTLY, BUT NOT IMPOSSIBLE.
IN 1998, A TEAM WAS ABLE TO FIND THE ENCRYPTION KEY FOR A MESSAGE
IN TWO DAYS USING ABOUT $250,000 WORTH OF HARDWARE.
HOWEVER THE PRICE IN TIME WILL GO DOWN
AS COMPUTER POWER INCREASES.
FROM 1997 TO 2001,
THE GOVERNMENT HELD ANOTHER COMPETITION,
ULTIMATELY ADOPTING A NEW METHOD DEEMED A.E.S.
WHICH STANDS FOR ADVANCED ENCRYPTION STANDARD.
THIS METHOD USES ENCRYPTION KEYS WITH 128, 192 OR 256 BITS
PROVIDING UP TO TWO THE POWER OF 256 POSSIBLE KEYS
MAKING BRUTE FORCE ATTACKS ESSENTIALLY IMPOSSIBLE.
I HOPE YOU FOUND THIS LESSON HELPFUL.