Tiny Bytes: RSA
tldr RSA works by exploiting the fact we can’t easily factor 2 large prime numbers and group theory to make a trapdoor permutation, aka a function that turns x into y but y can’t easily be turned into x without a secret. However, implementing RSA gets tricky because there’s lots of subtle attacks.MathRSA takes advantage of the group Z^*_{n} (multiplicative group of integers modulo n). This is the non-negative integers less than n that have an inverse modulo n. 1 x 1 mod n = 1. 0 x int = 0 so ...
Tiny Bytes: Chilling
Hi, Just chilling tonight. Aiming to finish up chapter tomorrow. Night, Lucas
Tiny Bytes: Quickie
Hi, Did much more writing on RSA. Will finish soon. Bye, Lucas
Tiny Bytes: RSA
tldr RSA works by exploiting the fact we can’t easily factor 2 large prime numbers and group theory to make a trapdoor permutation, aka a function that turns x into y but y can’t easily be turned into x without a secret. However, implementing RSA gets tricky because there’s lots of subtle attacks.MathRSA takes advantage of the group Z^*_{n} (multiplicative group of integers modulo n). This is the non-negative integers less than n that have an inverse modulo n. 1 x 1 mod n = 1. 0 x int = 0 so ...
Tiny Bytes: Chilling
Hi, Just chilling tonight. Aiming to finish up chapter tomorrow. Night, Lucas
Tiny Bytes: Quickie
Hi, Did much more writing on RSA. Will finish soon. Bye, Lucas
Subscribe to ldnovak
Subscribe to ldnovak
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
Helllo,
Today I’m going to talk about hash functions. What they are, how they work, and why they are incredibly cool. Quick note: my goal for today is to explain this concisely. As mentioned in the reflection, I tend to underestimate what I need to add. Today, I will try and over-estimate.
Hash functions turn data into a random number. Hash(1234) = random number. Hash(“why hello there“ = different random number. Hash(The Entire Bee Movie) = another different random number.
How the random number is generated and how long the random number is dependent on the type of hash function (SHA256 uses SHA-2 and makes numbers that have 256 bits or are between 0 and 2^256-1).
What’s important to know about hash functions is that they take data and turn it into a consistent random number. SHA256(1234) will always be the same random number with NO relation to SHA256(1235). (You can play around with functions here if you don’t believe me). It’s important to highlight that the hash can often be much smaller than the input (the SHA256 of a 1TB file is still 256 bits).
https://emn178.github.io/online-tools/sha256.html
Hash functions are complicated. I barely understand the math when I read someone else, let alone try to explain.
Trying high level to lower level explications:
We scramble and compress the file
We shift and xor the bits of the file with itself until it’s smaller and we run out of bits
We continually apply a compression function / encrypt the file with itself.
If the file is made up of Blocks B1, B2, … Bn, we compress(Bi, Bi+1) for i-0 to n.
How do we know they are random? Experts try to break the math and run experiments to see a correlation between input and outputs (if there’s a correlation, they aren’t random). Over time, people have found issues with old hash functions. Sometimes computers speed up, and suddenly 64 bits go from decades to compute to minutes. Technically, we don’t know they are random; we just can’t prove they aren’t random (pseudo-random functions).
Are two random hashes ever the same? Yes, this is called a collision. It can add complications. There are mathematically guaranteed to be collisions. If 100 people try to get a seat on a bus with 50 chairs, some people will have to stand. If we want to turn EVERY SINGLE NUMBER into a number between 0-2^256-1, there will be collisions (this is called the pigeon hole theorem).
Hash functions are amazing because they give us a small, random number. While this might seem mid, THIS IS POWERFUL.
This can help me sort files. For example, say I want to store books on my bookshelf. I could store them alphabetically; however, some letters are the first letter more than others. I’m not going to see many Xs or Zs. If I’m looking for a book that starts with T, I will get stuck looking through books that begin with “The.” For millions of files, this is not efficient. If I could get a random number between 1-26 to represent the book, my books would be balanced much better (or uniformly) and be easier to find.
This lets me prove things. If I want to know if my file has been corrupted, I can see if the hash is the same as I remember instead of comparing it line by line. I want to prove that I called “Warriors in 6” but am too chicken to reveal it before they win; I can hash the information, publish it on the internet, and when the Warriors win, I'll reveal the phrase. Now everyone can check if the hash matches. Also, hashing functions are used to build cryptographic keys and functions which are essential to everything.
That’s all folks. Hope you enjoyed. I mad it in time :)
Lucas
Note to self: The what, how, why structure needs some retuning. When explaining the what it’s nice to say why something is important and not leave the to the end. For the how, why statements are important because I’m giving a reason (TRUST ME THIS IS TRUE => this is why it’s true).
I guess this is less about adding why to what & how and more about adding natural extensions to information given (X means Y. If we are doing A worry about B. Hash functions turn File into 256 bits → compression. We turn files into random numbers → why are they random and what happens if there’s a collision.)
Helllo,
Today I’m going to talk about hash functions. What they are, how they work, and why they are incredibly cool. Quick note: my goal for today is to explain this concisely. As mentioned in the reflection, I tend to underestimate what I need to add. Today, I will try and over-estimate.
Hash functions turn data into a random number. Hash(1234) = random number. Hash(“why hello there“ = different random number. Hash(The Entire Bee Movie) = another different random number.
How the random number is generated and how long the random number is dependent on the type of hash function (SHA256 uses SHA-2 and makes numbers that have 256 bits or are between 0 and 2^256-1).
What’s important to know about hash functions is that they take data and turn it into a consistent random number. SHA256(1234) will always be the same random number with NO relation to SHA256(1235). (You can play around with functions here if you don’t believe me). It’s important to highlight that the hash can often be much smaller than the input (the SHA256 of a 1TB file is still 256 bits).
https://emn178.github.io/online-tools/sha256.html
Hash functions are complicated. I barely understand the math when I read someone else, let alone try to explain.
Trying high level to lower level explications:
We scramble and compress the file
We shift and xor the bits of the file with itself until it’s smaller and we run out of bits
We continually apply a compression function / encrypt the file with itself.
If the file is made up of Blocks B1, B2, … Bn, we compress(Bi, Bi+1) for i-0 to n.
How do we know they are random? Experts try to break the math and run experiments to see a correlation between input and outputs (if there’s a correlation, they aren’t random). Over time, people have found issues with old hash functions. Sometimes computers speed up, and suddenly 64 bits go from decades to compute to minutes. Technically, we don’t know they are random; we just can’t prove they aren’t random (pseudo-random functions).
Are two random hashes ever the same? Yes, this is called a collision. It can add complications. There are mathematically guaranteed to be collisions. If 100 people try to get a seat on a bus with 50 chairs, some people will have to stand. If we want to turn EVERY SINGLE NUMBER into a number between 0-2^256-1, there will be collisions (this is called the pigeon hole theorem).
Hash functions are amazing because they give us a small, random number. While this might seem mid, THIS IS POWERFUL.
This can help me sort files. For example, say I want to store books on my bookshelf. I could store them alphabetically; however, some letters are the first letter more than others. I’m not going to see many Xs or Zs. If I’m looking for a book that starts with T, I will get stuck looking through books that begin with “The.” For millions of files, this is not efficient. If I could get a random number between 1-26 to represent the book, my books would be balanced much better (or uniformly) and be easier to find.
This lets me prove things. If I want to know if my file has been corrupted, I can see if the hash is the same as I remember instead of comparing it line by line. I want to prove that I called “Warriors in 6” but am too chicken to reveal it before they win; I can hash the information, publish it on the internet, and when the Warriors win, I'll reveal the phrase. Now everyone can check if the hash matches. Also, hashing functions are used to build cryptographic keys and functions which are essential to everything.
That’s all folks. Hope you enjoyed. I mad it in time :)
Lucas
Note to self: The what, how, why structure needs some retuning. When explaining the what it’s nice to say why something is important and not leave the to the end. For the how, why statements are important because I’m giving a reason (TRUST ME THIS IS TRUE => this is why it’s true).
I guess this is less about adding why to what & how and more about adding natural extensions to information given (X means Y. If we are doing A worry about B. Hash functions turn File into 256 bits → compression. We turn files into random numbers → why are they random and what happens if there’s a collision.)
No activity yet