431 points · by signa11 · 5y ago · 99 comments
Like a lot of people (I imagine) I made it through a CS bachelors program not really ‘getting’ the discrete math combinatorics part. Crypto is an area where those concepts really really matter. It’s great to see this resource available!
It's a shame that match curriculum for non-math-majors is an all-roads-lead-to-calculus affair. I think we scare a lot of potentially talented people away from math with that approach.
Discrete math is very important to computer science. But in the rest of the world, calculus (and differential equations) dominate.
I took extra calculus classes from the math department. Those are way harder than what you need for introductory physics.
(I recall one day in 3rd year calculus course realizing "wait a second... I don't need to be here!". I just kept signing up for calculus every year since 11th grade and suddenly realized I don't need, don't want, and don't like the class nor the prof I was in, and that was one pain less I could instill upon myself :)
At least to my knowledge there is no 'theory of calculus' which allows one to solve generic integrals or differentials, calc is as much an unrelated art to comp sci as learning to play chess will help with accounting.
(Though, what do you mean by calculus? I assume you mean integration and differentiation and real numbers and stuff? Or something else?)
book.pdf
Really? I'm saving the file for a later review and this name will guarantee I either completely lose the file or will spend more time than necessary to locate it. The other option is to rename the file on saving, which is some work which needs to be performed by each user, instead of being done just once on the source. I think this is just impolite.
Here's a proper name you can copy-paste:
Mike_Rosulek_-_The_Joy_Of_Cryptography_(draft_2021-01-03).pdf
PS: The short-link-for-verbal-sharing problem is solved via a symbolic link.
On the second thought, one part of my job is preparing products for the final consumption, so this attention to minutiae is probably a professional deformation.
I'd like to see material around modern stuff (Keccak and ECC) with only a cursory discussion of pitfalls of the past standards in contrast with the current stuff. And more time on asymmetric, discrete log and fiat-shamir protocols that are so much fun and require really a 7th grade algebra to grasp.
I've also made a couple of videos on ECC basics with that approach: https://www.youtube.com/channel/UCk0r9S76wngNPJb_GlhJYdw
EDIT: what i mean, is focus first on how to use primitives and what they promise, rather than how they actually work. Once you feel like you can play with these legos, it's more fun to dig deeper and see why ECDLP is hard and how ciphers are made. But please don't start from within - it's an annoying boring mess that distracts from the true beauty: the cool things you can build with these tools.
These sorts of "provable security" textbooks (like the one in the article) try and do that. They emphasise less the exact inner workings of algorithms, and more on what they supposedly achieve. Various kinds of security proofs are possible. This school of thought in cryptography does also allow you to argue fairly convincingly that some concrete ciphers are secure. So it can talk about both the inner workings of ciphers as well as what security properties they achieve.
The "provable security" approach seems to be in line with your suggestion. In fact, it was the framework under which Zero Knowledge Proofs were developed. Not every cryptographer knows about that though, so I'm not sure if you were aware...
This makes it language agnostic. Code can be very opinionated in my opinion.
In some sense, programming languages are a mathematical notation, too.
Thank you for posting this book, I'll give it a go! Crypto is one of those things I have on my shameful "how-come-you-don't-know-it-yet" to-learn list :).
[1] https://www.youtube.com/channel/UC1usFRN4LCMcfIV7UjHNuQg
Compared to this book you seem right, the glimps I had was easily digestable and still concise.
For inquiries related to this book, use x@joyofcryptography.com, where x is the author's first name.
-
Nearly everyone with a high school education can “crack” that puzzle and figure out his email and yet most bots will fail.
i always thought the hotness would be to encrypt the address in source text and render/decrypt it client side in javascript, but i suppose scrapers these days use full blown headless browsers complete with javascript runtimes.
Mail to the literal 'x@joyofcryptography.com' address would just be dropped. There's no expectation that mail to a nonexistent address would be placed in the postmaster mailbox.
Someone please correct me if I'm wrong.
[1] https://github.com/signalapp/libsignal-protocol-java/blob/ma...
[2] https://signal.org/docs/specifications/doubleratchet/Set0_1....
That said, depending on the construction you use, nonrandom IVs can be a problem (they can leak that there's a relationship between different plaintexts if they line up with a difference in the first block), so you're better off at least making it a random function of the key and said blob/etc ID.
Or more specifically how could I create a book with formatting that looks as nice as this.
So should I see primes as a weakness in cryptography?
First of all, primes are only used to arrive at a session key, and once you have a session key you're in the land of symmetric algorithms, which provide security by permutations rather than vectoring into prime spaces. The content of a web page does not matter at all in terms of the security being provided. A 404 is just as secure as a valid home page, in terms of cryptography. (Not in terms of application security, but that's a whole different thing.)
Second, the supply of prime numbers is countable but also infinite, and the relation between a number space and the number of primes within it is well established within the workable sizes. We have upper and lower bounds on the number of primes within certain ranges. This is partly why we end up with certain key sizes as being secure and other key sizes as being insufficient. Secure key sizes (in asymmetric algorithms) partly are secure because there are so many primes that can be fodder for key generation.
A fun way to improve one's intuition for the huge space of primes in the regions that are used in cryptography is to run something like
openssl prime -generate -bits 1024
(This would give you one of two secret parameters for a 2048-bit RSA modulus.)
Here is an example output:
171512683213144641422165911053946068613736141364433791764418217818329805042681574174826781297743340609766353737741548521280185783254625590756752560896455821248403501924867464886010664489035275551178636464876794754383911750620888923620343965444339734253757757361106691647372710935609902417522529107877592063581
Not very easy to guess just because the space in question is limited to "1024-bit primes"!
And indeed, that's part of why we use primes that are this big when we still use RSA. They're big enough that the number of possibilities makes them not easy to guess (even given the extra hint of "the secret number you're looking for is one of the factors of this 2048-bit semiprime").
Exponentials are always hard for human intuition. We start with some kind of pattern and it feels like there just aren't that many numbers that would satisfy it. But when you get out to large numbers (even numbers as large as the one above), there just are that many numbers that would satisfy the pattern!
The point about the webserver was using methods to work out what the underlying webserver and version was and potentially the OS, after all not much point trying to decrypt an algo that is not used on the webserver, but metadata is given out by many webservers to suggest what type of webserver it is.
And then there is education, we see people believe many things because this is what's taught to them, we see this cognitive dissonance with religious people but also in "educated" people like some GP's or academics because its their life's work and I'm sure cryptography has consumed many hours of people thinking things through, without much time spent on other areas of weakness like the limitations of a cpu and memory registers.
After all how many crypto experts are fully conversant with the inner workings of a CPU design? If they were conversant with CPU designs would Spectre and Meltdown have been found years earlier?
Admittedly side channel attacks but I did say in my original post "Whilst theory is different in practice due to machine limitations" and this is the thing is the current implementation of cryptography on devices suitable when considering the design of CPU's and devices?
(Not because of any weakness, but because there are better, more efficient algorithms instead.)
Elliptic curves are faster and use smaller keys, but they're also a more fragmented ecosystem; plus, in particular for the older NIST curves, there is the unshakable fear that they're backdoored by the NSA (since they use magic unexplainable numbers, which RSA does not).
Thankfully ed25519 gave us an alternative free of magic numbers, and it's seeing a lot of adoption (in particular in open source software), but it's nowhere near taking over RSA.
This is all 100% pedantry. But the belief that RSA is risky because "prime numbers" is false, and worth pushing back on. There are reasons not to use RSA, but they're not as simple as "we don't trust prime field cryptography".