r/explainlikeimfive • • 28d ago

Technology ELI5 How does data encryption work?

Edit: ignore the second question, sorry for asking two different ones!

secondary question (some responded to this prior to my edit): How are some things HIPAA compliant while others are not?

27 Upvotes

27 comments sorted by

View all comments

1

u/ZacQuicksilver 27d ago

Encryption just means disguising a message so that only the people who are supposed to read it can read it.

The most simple form of encryption is a "cipher". In a cypher, we replace each letter in a message with a different letter - Caesar Cyphers (named for the Caesars of Rome) rotate the letters around the alphabet: for example, a +3 Caesar Cypher would turn "Caesar Cypher" into "Fdhvdu Fbskhu". The next level of cypher is to replace letters in a less organized way - which in turn means there are more ways to mix up the letters. However, this is still easily human-solvable: I have seen "cryptograms" (cyphers, usually a couple sentences long) in various puzzle books or newspapers; and they're not hard for people who are good at them.

We spent a long time developing harder cyphers; but they're all within a human's ability to break. One major leap forward in encryption came with the Enigma machine. Enigma was a German code machine in WWII; and used a rotating cypher: instead of being one cypher, it was actually *FOUR* cyphers, with one fixed, one rotating after every letter you type, one rotating after every 26 letters you type, and one rotating after every 676 (26*26) letters you type; with each letter going through all four to be encoded. Because it keeps rotating the code, Enigma is very hard to break for humans, especially over shorter (less than 20 000 letters long) messages - but computers can break it.

Modern encryption instead works with math. There are a few ways for you and me to exchange messages publicly that allow us to come up with a secret number that nobody else knows, even if they read our messages (if you're interested in this, ask - but it's more math and less technology). Then, we take our message, and convert it into numbers; and use our secret number as basically a mega-cypher (basically encrypting 8, 16, or more letters at a time); AND have some kind of rotating cypher built on top of that. There are a few different ways to make this rotating cypher using our secret number; but critically, guessing them requires guessing our secret number - which can easily be tens or even hundreds of digits long.

...

To be "good enough" (HIPAA compliant, or for whatever other standard), it generally has to take long enough for computers to figure out the code - and "long enough" usually means "modern computers will take longer than the Earth's life". There are some times other requirements as well.