Animated Explanation of the one-time pad

Поділитися
Вставка
  • Опубліковано 26 лип 2024
  • Video walkthrough of code implementation: • One Time Pad Explanati...
    Explanation of converting from decimal to binary: www.khanacademy.org/math/alge...
    Explanation of XOR: • Bitwise XOR Operation
    More info about the one-time pad's use throughout history: learn.adafruit.com/raspberry-...
    ===== Social Media/Contact =====
    canadiancoding.ca/
    / canadiancoding
    github.com/canadian-coding
    kieran@canadiancoding.ca

КОМЕНТАРІ • 36

  • @breathandrelax2
    @breathandrelax2 3 роки тому +19

    whoa! after searching for hours finally you made it crystal clear. thank you buddy. you the man

  • @kyokokirigiri166
    @kyokokirigiri166 Рік тому +1

    you are amazing in teaching simple and straight to the point and making it funny at the same time. thank you for your time!

  • @greatonreviews
    @greatonreviews 2 роки тому +2

    Amazing , super clear and precise! Thank you! :D

  • @MrBitviper
    @MrBitviper 2 роки тому +1

    thanks for the clear explanation. much appreciated

  • @NyorexDC
    @NyorexDC 3 роки тому +2

    Dude I love this, thanks

  • @lucarauchenberger628
    @lucarauchenberger628 3 роки тому +1

    very well explained

  • @dilshadurrahman4248
    @dilshadurrahman4248 2 роки тому +1

    Nice explanation of OTP. Thanks.

  • @azuboof
    @azuboof 8 місяців тому

    beautiful animations

  • @funny-re1vf
    @funny-re1vf 3 роки тому

    great video ..thank you so much

  • @jack.p
    @jack.p 3 години тому

    So if there was an agent in the field, they might be given a OTP in person before leaving, then if and when a message needs to be sent, they could just broadcast it publicly in complete confidence?

  • @maomxesoax2471
    @maomxesoax2471 3 роки тому +3

    ENCRYPT: (msgcharvalue + otpcharvalue) - 1 DECRYPT: (encryptcharvalue - otpcharvalue) + 1 If a result is more than the character set length or is less than zero then mod it by character set length.

  • @civedm
    @civedm 3 роки тому +8

    I'm pretty sure the original idea of the one-time-pad didn't involve ACSII and binary. The system was such that it could be easily done on a piece of paper by hand.

    • @canadiancoding
      @canadiancoding  3 роки тому +2

      It may not have used ASCII specifically (numbers may have been different), but it would've worked exactly the same. The ASCII version, and any other character coded system can be done on paper (I had to do that for this video actually).

    • @leif_____8579
      @leif_____8579 2 роки тому

      OTP was mainly used by Secret services. Agents were given a sheet of numbers (The equivalent to the key here) with which they could decrypt secret messages.

  • @LLNB2196
    @LLNB2196 2 роки тому

    Damn, I love your humor hahahah

  • @handsomeman-pm9vy
    @handsomeman-pm9vy Рік тому

    It is also the final operation in every Stream Cipher.

  • @yojumba
    @yojumba 3 роки тому

    Thx for the great explanation!

  • @JuanGerardoHernandez
    @JuanGerardoHernandez 2 роки тому +2

    How Bob get the pad form Alice?

    • @canadiancoding
      @canadiancoding  2 роки тому

      There are essentially an infinite number of ways to do this. These could include any form of network interaction like sending messages back and forth via WIFI, all the way to printing the details out and doing it by hand would work. That section of the protocol allows for a ton of leniency to implement however works best for you.

  • @mattd6085
    @mattd6085 2 місяці тому

    What binary translation are you using to get your numbers? If your ASCII strings are, for example, 51 for the plain text first letter and 101 for the pad first letter, then the binary conversion will be of a differing length? You can't do XOR with differing string lengths of binary.

    • @canadiancoding
      @canadiancoding  2 місяці тому

      This is actually a good point. I should have mentioned it during the video. If you watch the animation from 3:55 onward you will see every number is left-padded (add 0's to the left) to 8 bits. So every number is 1 byte, and if it can be stored in less bytes then it's just less efficient. This is because ASCII is a fixed-length encoding, whereas something like Unicode makes this more complicated. Hope that makes sense

  • @ninmarwarda5154
    @ninmarwarda5154 2 роки тому

    But if Eve has the pad and ciphertext then she can easily decrypt it, right? And it is usually the case that the pad and ciphertext are public, isn't it?

    • @canadiancoding
      @canadiancoding  2 роки тому

      The pad in this example is typically the thing that is kept secret or is somehow obfuscated. This means the content itself can be distributed publicly without worry, and the only thing you need to keep safe is the pad. Likewise it means you can use the same pad for multiple pieces of content (VERY NOT IDEAL security wise) which means you only have to keep 1 thing private and everything else after that can just be distributed publically.
      Alternatively it can be distributed with some sort of encryption that then has a handshake to allow the decryption key to be distributed. For example you might distribute an encrypted pad over a public channel, but it is locked behind a 16 digit password that was transferred using something like the Diffie-Hellman key exchange (github.com/Descent098/Diffie-Hellman), or even just setup a secure connection with something like SSL (www.ssl.com/faqs/faq-what-is-ssl/) using a key exchange to distribute the pad privately.

  • @war-c0mmander
    @war-c0mmander 2 роки тому

    👍

  • @purple3036
    @purple3036 Рік тому

    how the pad is exchanged?

    • @canadiancoding
      @canadiancoding  Рік тому

      There isn't any specific way to do this, ideally this is a step you would do "in-private", since if you do it "in-public" this part would need to be secured somehow (no specifics given in the OTP protocl). If eve is able to get ahold of the pad while in transfer then the whole system is no longer secure. One option is to do public-key exchange and then encrypt the pad with a key when you send it. Something like diffie-hellman can do this, which I created a repo to explain here: github.com/descent098/diffie-hellman
      Thanks for watching!

  • @BucolicLife
    @BucolicLife 11 днів тому

    I read on Wikipedia that it is the only encryption mechanism that is not breakable no matter what quantum computer together with any mathematical decryption algorithms is used. Is that correct? If so, then is this the ultimate encryption system?

    • @Descent098
      @Descent098 7 днів тому

      The version I explained in my video is not quantum secure afaik. I think you could make it EFFECTIVELY quantum secure if your note is long enough, but the protocol itself is not secure against quantum attacks. There are versions of the one-time pad that could be, but they're more complicated.
      I think what you're referring to is when people call the one time pad a "perfectly secret" scheme. All this means is that the ciphertext we use doesn't leak any information, meaning there are no side channel attacks. This is all a fancy way to say that you can't get information AT ALL about the content you're trying to encrypt, from how you encrypted it. Other methods will use the source text to generate their encryption, and so they are not "perfect secret" schemes.
      I can't cite sources in a youtube comment but if you google "perfect secrecy" there is a video on khan academy, and one on wolfram U that will explain the concept well.
      For post-quantum security there's a good channel called Chalk Talk here on youtube that cover quantum secured approaches like lattice-based cryptography.

    • @canadiancoding
      @canadiancoding  7 днів тому

      The version I explained in my video is not quantum secure afaik. I think you could make it EFFECTIVELY quantum secure if your note is long enough, but the protocol itself is not secure against quantum attacks. There are versions of the one-time pad that could be, but they're more complicated.
      I think what you're referring to is when people call the one time pad a "perfectly secret" scheme. All this means is that the ciphertext we use doesn't leak any information, meaning there are no side channel attacks. This is all a fancy way to say that you can't get information AT ALL about the content you're trying to encrypt, from how you encrypted it. Other methods will use the source text to generate their encryption, and so they are not "perfect secret" schemes.
      I can't cite sources in a youtube comment but if you google "perfect secrecy" there is a video on khan academy, and one on wolfram U that will explain the concept well.
      For post-quantum security there's a good channel called Chalk Talk here on youtube that cover quantum secured approaches like lattice-based cryptography.

  • @HenryCasillas
    @HenryCasillas 2 роки тому

    ☮️

  • @DeleriousOdyssey
    @DeleriousOdyssey 2 роки тому +1

    Why is this so hard for me to understand? Lol

  • @wheelieblind
    @wheelieblind 2 роки тому

    Next time use unicode lol

    • @canadiancoding
      @canadiancoding  2 роки тому +2

      For a video like this Unicode is unwieldy, this is meant to be an intro not a how-to necessarily. The primary purpose of this video was for a course I took where the prof wanted a teaching utility to show people about the protocol. ASCII is just simple because it's a small enough collection to do by hand while being expressive enough to be useful. In the real world the character encodings themselves get incredibly annoying to deal with (especially with bloody emoji's), and Unicode would be better especially for languages other than English. Thanks for watching!

  • @c.j.1089
    @c.j.1089 2 роки тому +1

    this overcomplicates the one time pad immensely.