Encryption and public keys | Internet 101 | Computer Science | Khan Academy

Hi my name is MIA gillip nur I'm majoring in computer science at UC Berkeley and I work for the Department of Defense where I try to keep information safe the Internet is an open and public system we all send and receive information over shared wires and connections but even though it's an open system we still exchange a lot of .

Private data things like credit card numbers bank information passwords and emails so how is all this private stuff kept secret data of any kind can be kept secret through a process known as encryption these scrambling or changing of the message to hide the original text now decryption is the process of unscrambling that message to make it .

Readable this is a simple idea and people have been doing it for centuries one of the first well-known methods of encryption was Caesar cipher named after Julius Caesar a Roman general who encrypted his military commands to make sure that if a message was intercepted by enemies they wouldn't be able to read it .

Caesar cipher is an algorithm that substitutes each letter in the original message with a letter a certain number of steps down the alphabet if the number is something only the sender and receiver know then it's called the key it allows the reader to unlock the secret message for example if your original message is hello then using the .

Caesar cipher algorithm with a key of five the encrypted message would be this to decrypt the message the recipient would simply use the key to reverse the process but there's a big problem with Caesar cipher anybody can easily break or crack the encrypted message by trying every possible key in the English alphabet there are only 26 letters which .

Means you'd only need to try at most 26 keys to decrypt the message now trying 26 possible keys isn't very hard it would take at most an hour so let's make it harder instead of shifting every letter by the same amount let's shift each letter by a different amount in this example a 10 digit key shows how many positions each successive .

Letter will be changed to encrypt a longer message guessing this key would be really hard using 10 digit encryption there could be 10 billion possible key solutions obviously that's more than any human could ever solve it would take many centuries but an average computer today would take just a few seconds to try all 10 billion possibilities so in a .

Modern world where the bad guys are armed with computers instead of pencils how can you encrypt messages so securely that they're too hard to crack now too hard means that there are too many possibilities to compute in a reasonable amount of time today's secure communications are encrypted using 256 bit keys that means .

A bad guys computer that intercepts your message would need to try this many possible options until they discover the key and crack the message even if you had a hundred thousand super computers and each of them was able to try a million billion keys every second it would take trillions of trillions of trillions of years to try every option .

Just to crack a single message protected with 256 bit encryption of course computer chips get twice as fast and the size every year or so if that pace of exponential progress continues today's impossible problems will be solvable just a few hundred years in the future and 256 bits won't be enough to be safe in fact we've already had to increase .

The standard key length to keep up with the speed of computers the good news is using a longer key doesn't make encrypting messages much harder but it exponentially increases the number of guesses that it would take to crack a cipher when the sender and the receiver share the same key to scramble and unscramble a message it's called .

Symmetric encryption with symmetric encryption like Caesar cipher the secret key has to be agreed on ahead of time by two people in private that's great for people but the Internet is open and public so it's impossible for two computers to meet in private to agree on a secret key instead computers .

Use asymmetric keys a public key that can be exchanged with anybody and a private key that is not shared the public key is used to encrypt data and anybody can use it to create a secret message but the secret can only be decrypted by a computer with access to the private key how this works is with some math that we won't get into right .

Now think of it this way imagine that you have a personal mailbox where anybody can deposit mail but they need a key to do it now you can make many copies of the deposit key and send one to your friend or even just make it publicly available your friend or even a stranger can use the public key to access your deposit slot and drop a .

Message in but only you can open the mailbox with your private key to access all of the secret messages you've received and you can send a secure message back to your friend by using the public deposit key to their mailbox this way people can exchange secure messages without ever needing to agree on a private key public key cryptography is .

The foundation of all secure messaging on the open Internet including the security protocols known as SSL and TLS which protect us when we're browsing the web your computer uses this today anytime you see the little lock or the letters HTTPS in your browser's address bar this means your computer is using public key encryption to exchange data .

Securely with the website you're on as more and more people get on the internet more and more private data will be transmitted and the need to secure that data will be even more important and as computers become faster and faster we'll have to develop new ways to make encryption too hard for computers to break .

This is what I do with my work and it's always changing you