Fireship · @fireship

7 Cryptography Concepts EVERY Developer Should Know

Uploaded November 1, 2021 · Length 11:55

7 Cryptography Concepts EVERY Developer Should Know

Summary

Learn 7 essential cryptography concepts for developers, including hashing, encryption, and signing, and implement them in Node.js with hands-on examples.

  • cryptography concepts
  • node js crypto
  • hashing passwords
  • encryption
  • digital security
  • web development

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    Cryptography is terrifying. It's based on math that most of us don't understand, yet is the one thing that makes the internet secure.

  2. 0:06

    Without the mysterious art of cryptography, there would be no secrets and no privacy in the digital world.

  3. 0:11

    Your emails, bank records, and browsing history would be easily hackable.

  4. 0:15

    Computers, by design, do exactly what we tell them to do, but sometimes we don't want them to do certain things, like expose private data.

  5. 0:22

    I'm sorry, Dave. I'm afraid I can't do that.

  6. 0:25

    Cryptography can take some useful bytes of data, then scramble them up with an algorithm,

  7. 0:30

    making it nearly impossible for a computer to understand its true meaning without the

  8. 0:33

    proper credentials. In today's video, we'll look at 7 useful crypto concepts that every developer

  9. 0:38

    should know. And the best way to learn this stuff is to get hands-on, so we'll implement each concept

  10. 0:42

    in Node.js with its built-in crypto module. And make sure to stay tuned until the end,

  11. 0:46

    because there's a challenge, and the first person to solve it gets a free lifetime pro membership

  12. 0:51

    and t-shirt. Cryptography is the science of creating secrets, and has been around long before

  13. 0:56

    the computer. Before humans got good at math, they would tattoo secrets on the shaved head of a slave,

  14. 1:00

    then let their hair grow out to obfuscate it. But there are some obvious vulnerabilities with this

  15. 1:04

    pattern. An attacker could simply shave the head to access the message. Things got much better by

  16. 1:08

    the time of Julius Caesar, who shifted the letters of the alphabet before passing messages to his

  17. 1:13

    military generals, creating what's known as the Caesar Cipher. Now fast forward to 2025, and all

  18. 1:18

    the algorithms you're using today are made obsolete by super mega quantum computers that

  19. 1:22

    can crack them with brute force. The point I'm making is that cryptography is always evolving.

  20. 1:27

    What is considered safe and secure today may not be the case tomorrow. Luckily, as a developer,

  21. 1:31

    you don't need to understand all the complex math that goes into cryptography, but it is

  22. 1:35

    absolutely essential to understand how certain key concepts work, like hashing, encryption,

  23. 1:40

    and signing, just to name a few. The first concept we'll look at is the hash. What is a hash? The

  24. 1:45

    The name sounds kind of intimidating to me, but the word itself actually has culinary roots

  25. 1:48

    meaning to chop and mix, and that perfectly describes what a hashing function does.

  26. 1:53

    You start with an input, which can be any length, then pass it off to a hashing function.

  27. 1:57

    This function returns a fixed length value of what looks like just meaningless garbage.