The Caesar cipher (video) | Cryptography | Khan Academy (2024)

Want to join the conversation?

Log in

  • Michael pignatari

    11 years agoPosted 11 years ago. Direct link to Michael pignatari's post “why would Caesar use ciph...”

    The Caesar cipher (video) | Cryptography | Khan Academy (2)

    why would Caesar use ciphers?

    (28 votes)

    • Musiclovererer

      8 years agoPosted 8 years ago. Direct link to Musiclovererer's post “Caesar used ciphers so th...”

      The Caesar cipher (video) | Cryptography | Khan Academy (4)

      The Caesar cipher (video) | Cryptography | Khan Academy (5)

      Caesar used ciphers so that important information, such as the location of a attack or the date it would be carried out, would be unknown to enemies but know to the rest of his troop. If his messages were ever intercepted, the enemy would't immediately understand what the cipher meant.

      (24 votes)

  • Aayush

    11 years agoPosted 11 years ago. Direct link to Aayush's post “Decoding the Caesar Ciphe...”

    The Caesar cipher (video) | Cryptography | Khan Academy (7)

    Decoding the Caesar Cipher based on the "fingerprint" requires a large sample space . I mean lets say if the message contains few words or only single word even that frequency distribution wont help in that case ..

    (26 votes)

    • danny

      11 years agoPosted 11 years ago. Direct link to danny's post “To the original question,...”

      The Caesar cipher (video) | Cryptography | Khan Academy (9)

      The Caesar cipher (video) | Cryptography | Khan Academy (10)

      To the original question, yes, shorter messages make it harder to detect the frequency distribution, but you'd be surprised how quickly it shows up.
      To Skylear's comment: A Caesar Cipher does have a sample space. The random variable is the number used for the shift. In your example, you encoded JASON IS BLUE using a shift of 2, but 2 could have been 1 or 23 or 14. In fact, it could have been any number from 1 to 26. So the sample space has 26 possibilities (there are 26 different ways to apply a caesar's cipher to the message).

      (14 votes)

  • At

    The Caesar cipher (video) | Cryptography | Khan Academy (13) 0:37

    MEET is encrypted as PHHN. M is shifted "ahead" 3 letters to P, E is shifted "ahead" 3 letters to H (twice over), but then T is encrypted by shifting to the letter that PRECEDES it (by three)... why?

    (5 votes)

    • tiktok7

      9 years agoPosted 9 years ago. Direct link to tiktok7's post “Because it's wrong; the '...”

      The Caesar cipher (video) | Cryptography | Khan Academy (15)

      Because it's wrong; the 't' in "at" or "elephant" should be the same letter but it's W. The sequence should be 'p', 'h', 'h', 'w', 'p', 'h', 'd', 'w', 'h', 'o', 'h', 's', 'k', 'd', 'q', 'w', 'o', 'd', 'n', 'h'

      (4 votes)

  • Everett Fasnacht

    3 years agoPosted 3 years ago. Direct link to Everett Fasnacht's post “Do we still use written c...”

    The Caesar cipher (video) | Cryptography | Khan Academy (17)

    Do we still use written ciphers today?

    (2 votes)

    • Cameron

      3 years agoPosted 3 years ago. Direct link to Cameron's post “Now a days written cipher...”

      The Caesar cipher (video) | Cryptography | Khan Academy (19)

      Now a days written ciphers are almost only used by hobbyists. Computers have made using much better modern ciphers, much easier (to the point that most people don't even realize when they are being used) and more secure.

      (6 votes)

  • jabariharrod

    a year agoPosted a year ago. Direct link to jabariharrod's post “Does anyone still use the...”

    The Caesar cipher (video) | Cryptography | Khan Academy (21)

    Does anyone still use the Ceasar cipher?

    (2 votes)

    • KLaudano

      a year agoPosted a year ago. Direct link to KLaudano's post “Outside of simple code-br...”

      The Caesar cipher (video) | Cryptography | Khan Academy (23)

      Outside of simple code-breaking puzzles and encoded messages sent by children, not really. A human could easily brute-force break the Ceasar cipher, so it would present no challenge at all to a computer. Modern encryption techniques (such as AES, RSA, ECC, and TwoFish) are far more complex and harder to break.

      (5 votes)

  • Nathan

    3 years agoPosted 3 years ago. Direct link to Nathan's post “How can one design a ciph...”

    The Caesar cipher (video) | Cryptography | Khan Academy (25)

    How can one design a cipher for languages with logographic (writing systems with thousands of letters, such as Chinese or hieroglyphics) such as these, considering that ciphers that rely on an ordered list of all letters may not be possible (such an ordering doesn't exist) or practical (the lookup table will be thousands of letters long, thus making the code not practical to decrypt by the receiver)?

    (3 votes)

    • Cameron

      3 years agoPosted 3 years ago. Direct link to Cameron's post “Approach 1:1) convert sy...”

      The Caesar cipher (video) | Cryptography | Khan Academy (27)

      Approach 1:
      1) convert symbols to their phonetic equivalents e.g. for Japanese you could write the kanji symbols as hiragana (you see this a lot in old Japanese video games)
      2) usually the number of phonetic chunks is < 100, so any look up table is manageable

      Approach 2:
      1) create a dictionary of all the symbols you want to use and then assign each one a number (this is basically how a computer displays kanji)
      2) Apply a numeric operation to encrypt, and its reverse to decrypt e.g. a shift like a Caesar cipher, or something more complex

      (3 votes)

  • Colton Reilly

    10 years agoPosted 10 years ago. Direct link to Colton Reilly's post “Does anybody know how to ...”

    The Caesar cipher (video) | Cryptography | Khan Academy (29)

    Does anybody know how to make a Caeser cipher using Python?

    (2 votes)

    • Cameron

      10 years agoPosted 10 years ago. Direct link to Cameron's post “It's been a long time sin...”

      The Caesar cipher (video) | Cryptography | Khan Academy (31)

      It's been a long time since I've used python but this should do the trick:

      def encrypt(messagetext,shift):
      ciphertext=""
      mlength=len(messagetext)
      for i in range(0,mlength):
      oldchar=ord(messagetext[i])-ord('a')
      newchar=(oldchar+shift)%26+ord('a')
      ciphertext += chr(newchar)
      return ciphertext

      def decrypt(ciphertext,shift):
      messagetext=""
      clength=len(ciphertext)
      for i in range(0,clength):
      oldchar=ord(ciphertext[i])-ord('a')
      newchar=(oldchar-shift)%26+ord('a')
      messagetext += chr(newchar)
      return messagetext

      mymessage = "hello"
      myshift = 3
      mycipher = encrypt(mymessage,myshift)
      mydecryptedcipher = decrypt(mycipher,myshift)
      print "Original Message: ",mymessage
      print "Cipher Text: ",mycipher
      print "Decrypted Cipher: ",mydecryptedcipher


      Note that the functions assumes that the text is in all lowercase

      Regardless of the language the technique is essentially the same, iterate through the string letter by letter and:
      -convert the character to an ASCII number
      -find the numerical difference from 'a'
      -add in the shift (or subtract the shift to decrypt)
      -mod 26 to keep it in the 'a' to 'z' range
      -add back in 'a' to get the right ASCII value for a letter
      -convert the new number to an ASCII letter

      Hope this makes sense

      (4 votes)

  • Balgarino

    10 years agoPosted 10 years ago. Direct link to Balgarino's post “What if I used a shift of...”

    The Caesar cipher (video) | Cryptography | Khan Academy (33)

    What if I used a shift of 46 or some other high number to encrypt my message ?
    How would that be deciphered ?

    (1 vote)

    • Cameron

      10 years agoPosted 10 years ago. Direct link to Cameron's post “All shifts will be a numb...”

      The Caesar cipher (video) | Cryptography | Khan Academy (35)

      All shifts will be a number from 0 to 25.
      If one tries to use a shift greater than 25 it will wrap around back to 0 again.
      If you use a shift X, the equivalent shift, from 0 to 25, can be calculated as:
      X mod 26
      or equivalently
      the remainder when you divide X by 26

      Hope this makes sense

      (3 votes)

  • Khan Gressman

    6 years agoPosted 6 years ago. Direct link to Khan Gressman's post “Would making a code langu...”

    The Caesar cipher (video) | Cryptography | Khan Academy (37)

    Would making a code language with only a few letters (6 for example) where each word had exactly one of each letter (so every word is 6 letters long). Wouldn't this erase the fingerprint (and make the brute force super easy)? Would it be a good idea for more secure ciphers?

    (2 votes)

    • Cameron

      6 years agoPosted 6 years ago. Direct link to Cameron's post “That would erase the lett...”

      The Caesar cipher (video) | Cryptography | Khan Academy (39)

      That would erase the letter frequency fingerprint, which would make things tougher for a hacker. However, it doesn't completely defeat frequency analysis as we can look at the frequency of the words. Common words and word combinations will also produce a fingerprint.

      A similar approach to trying to eliminate the letter frequency is to not use letters at all, and just use a code book where each word is represented by a number. A famous example of this is the Zimmerman Telegram: https://en.wikipedia.org/wiki/Zimmermann_Telegram

      (1 vote)

  • sjoshi

    8 years agoPosted 8 years ago. Direct link to sjoshi's post “So normally when you make...”

    The Caesar cipher (video) | Cryptography | Khan Academy (41)

    So normally when you make a code and say to your sender in a meeting the shift amount before you actually start sending the messages, what if the intercepter somehow was able to intercept that? Won't you have to disguise that? And what if the intercepter knew about that? Wouldn't all this cause you to go into a cycle of crypticity, disguising everything you do? So is it really possible to disguise it? How do you disguise it? Does it have anything to do with "Journey into cryptography?"

    (2 votes)

    • Al Sweigart

      8 years agoPosted 8 years ago. Direct link to Al Sweigart's post “You are exactly right. If...”

      The Caesar cipher (video) | Cryptography | Khan Academy (43)

      You are exactly right. If your communication line is being tapped, you can't say "let's use an encryption key of H" because then the listener will know the key. It makes encryption completely useless.

      However, this only applies to symmetric key ciphers, which means the same key is used to encrypt and decrypt messages. There are asymmetric key ciphers, where you have two keys. A message encrypted with one key can only be decrypted with the other. So you keep one key a secret to yourself (the "private key") and the other you share with the world (the "public key"). If someone wants to send you a message, they just encrypt it with your public key and send it. Only you, with your private key, can decrypt it. You don't have to meet up before hand to share keys.

      RSA is an example of an asymmetric key cipher.

      (1 vote)

The Caesar cipher (video) | Cryptography | Khan Academy (2024)

FAQs

How to solve Caesar cipher? ›

To decrypt a message encoded with a Caesar cipher, simply take the value of 26 minus the shift value, and apply that new value to shift the encoded message back to its original form.

What was Caesars secret code? ›

It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on.

How to solve encrypted messages? ›

All substitution ciphers can be cracked by using the following tips:
  1. Scan through the cipher, looking for single-letter words. ...
  2. Count how many times each symbol appears in the puzzle. ...
  3. Pencil in your guesses over the ciphertext. ...
  4. Look for apostrophes. ...
  5. Look for repeating letter patterns.
Mar 26, 2016

How to decrypt the ciphertext? ›

The decryption of a ciphertext is carried out by inputting the encryption key that was used to encrypt it in the first place. Once the correct key is applied, the plaintext is revealed. Decryption is a one-time process.

What is the formula for Caesar cipher? ›

Caesar Cipher is one of the simple methods in cryptography. This method requires two inputs one a number and a plaintext. The Time Complexity and Space Complexity both are O(N). The encryption formula is En(x) = (x + n) mod 26 and the Decryption formula is Dn(x) = (x – n) mod 26.

Is Caesar cipher easy? ›

Caesar ciphers are very simple to create but are also quite easy to crack. One method we can use to crack ciphers is called Frequency Analysis. This is where we look at the frequency (i.e. the number of times) that each letter appears.

What is the classic Caesar code? ›

The Caesar Cipher is a monoalphabetic rotation cipher used by Gaius Julius Caesar. Caesar rotated each letter of the plaintext forward three times to encrypt, so that A became D, B became E, etc., as shown in Table 4.6. Table 4.7 shows how “ATTACK AT DAWN” encrypts to “DWWDFN DW GDZQ” using the Caesar Cipher.

Why is it called 12 caesars? ›

The incidents are adapted from Suetonius's On the Lives of the Caesars, a collection of imperial biographies written in Latin in the second century A.D. Suetonius's work describes the lives of Rome's first 12 leaders from Julius Caesar to Domitian - hence it is best known today as The Twelve Caesars.

What is Caesar's secret? ›

Caesar's Secrets. Julius Caesar used cryptography during the Gallic Wars. His method was to substitute each letter in the alphabet by that letter shifted right by some fixed offset. A->D, B->E, C->F, ... , W->Z, X->A, Y->B.

How do people solve ciphers? ›

To start out on these puzzles, look for the most frequent letter in each cryptogram — you'll find it's almost always E. Single-letter words will be A or I. The words THE, AND, and THAT are the most commonly seen short words in English. Double letters and apostrophes are also helpful when cracking ciphers.

How to solve a cipher with a key? ›

To decode a substitution cipher with a key, you'll need to replace each letter in the encrypted message with the corresponding letter from the key. For example, if the key says "A" corresponds to "D", you'd replace every "A" in the encrypted message with a "D". By following the key, you can decipher the entire message.

How to figure out what cipher was used? ›

Find the cipher using Chrome
  1. Launch Chrome.
  2. Enter the URL you wish to check in the browser.
  3. Click on the ellipsis located on the top-right in the browser.
  4. Select More tools > Developer tools > Security.
  5. Look for the line "Connection...". This will describe the version of TLS or SSL used.
Mar 1, 2023

How do you decode a Caesar cipher? ›

Encrypt your message by replacing each letter with the corresponding shifted letter. For example, if the shift value is 3, the word “hello” would become “khoor”. To decrypt the message, simply reverse the process by shifting each letter back by the same amount.

What is the cipher code for I love you? ›

For example, you might use the following code to express "I love you": "Lfh qlrqjv wkh vwdwh" (using a simple substitution cipher, where each letter is replaced by the letter that comes three places later in the alphabet)

What is a shift of 3 in Caesar cipher? ›

With a shift of 3, every letter is replaced by the letter 3 letters to its right. Letters at the end of the alphabet wrap around to the beginning (e.g. 'z' shifted by 3 becomes 'c').

How do you code a Caesar cipher decoder? ›

Write down the letters of the alphabet in order, from A to Z. Shift each letter of the alphabet by the “shift” value. For example, if the shift value is 3, A would become D, B would become E, C would become F, and so on. Encrypt your message by replacing each letter with the corresponding shifted letter.

How is Caesar cipher broken? ›

The Caesar Cipher, used by Julius Caesar around 58 BC, is a substitution cipher that shifts letters in a message to make it unreadable if intercepted. To decrypt, the receiver reverses the shift. Arab mathematician Al-Kindi broke the Caesar Cipher using frequency analysis, which exploits patterns in letter frequencies.

How to find key in Caesar cipher? ›

Preparation
  1. Explain the concept of a Caesar cipher to a friend or have them read the background section of this activity.
  2. Write down the alphabet from A to Z.
  3. Pick a number from 1 to 25. (If you use 26, you will just wind up with the original alphabet.) This number is your key.
Oct 6, 2016

What is a Caesar cipher for dummies? ›

In the case of the Caesar Cipher, this operation was very simple: you just had to shift each letter in your message forward by a given number. This number was like your key. You shared it with the recipient of your message, so that only they could unlock your message.

Top Articles
Latest Posts
Article information

Author: Margart Wisoky

Last Updated:

Views: 5805

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Margart Wisoky

Birthday: 1993-05-13

Address: 2113 Abernathy Knoll, New Tamerafurt, CT 66893-2169

Phone: +25815234346805

Job: Central Developer

Hobby: Machining, Pottery, Rafting, Cosplaying, Jogging, Taekwondo, Scouting

Introduction: My name is Margart Wisoky, I am a gorgeous, shiny, successful, beautiful, adventurous, excited, pleasant person who loves writing and wants to share my knowledge and understanding with you.