Live data from Hacker News

The Joy of Cryptography

joyofcryptography.com

31–40 of 105 posts

Re: The Joy of Cryptography

#31
post #13

Earlier quoted context omitted.

Somehow discrete math was the only math I understood in CS. Calculus, on the other hand, completely eluded me.

If the whole of math were represented by the surface of the planet, "discrete math" would be more than half of it. Calculus (i.e. differentiation/integration on the reals) on the other hand, would be a city. Perhaps a very populated city, but just one. 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 wi…

I'm not sure why you think that? Basically all of physics, chemistry, and other physical sciences is calculus. Calculus is the mathematics of rates of change, and basically all physical science is the study of change.

Discrete math is very important to computer science. But in the rest of the world, calculus (and differential equations) dominate.

Re: The Joy of Cryptography

#32

I've often thought the use of prime numbers to be the weakness in cryptography. Whilst theory is different in practice due to machine limitations, there are only so many prime numbers a machine can present in a limited timespan restricting the range of primes available to use. With this in mind, and then knowing what a webserver will typically use by simply browsing the website with different encryption algo's disabl…

Almost no cryptography being deployed today uses prime numbers.

(Not because of any weakness, but because there are better, more efficient algorithms instead.)

Re: The Joy of Cryptography

#33
post #26

I've often thought the use of prime numbers to be the weakness in cryptography. Whilst theory is different in practice due to machine limitations, there are only so many prime numbers a machine can present in a limited timespan restricting the range of primes available to use. With this in mind, and then knowing what a webserver will typically use by simply browsing the website with different encryption algo's disabl…

No. 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 securi…

Well said.

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!

Re: The Joy of Cryptography

#34
post #11
post #3

This is the coolest way I have seen someone write their email and avoid email harvesting bots: 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 prefer cmlja2FzdGxleQ== at example.com, for instance, if the target audience is tech literate.

lol, nice one.

Re: The Joy of Cryptography

#35
post #13

Earlier quoted context omitted.

Somehow discrete math was the only math I understood in CS. Calculus, on the other hand, completely eluded me.

If the whole of math were represented by the surface of the planet, "discrete math" would be more than half of it. Calculus (i.e. differentiation/integration on the reals) on the other hand, would be a city. Perhaps a very populated city, but just one. 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 wi…

All of the advanced technology you use on a daily basis depends on calculus for it to be designed and fabricated.

Re: The Joy of Cryptography

#36

I've often thought the use of prime numbers to be the weakness in cryptography. Whilst theory is different in practice due to machine limitations, there are only so many prime numbers a machine can present in a limited timespan restricting the range of primes available to use. With this in mind, and then knowing what a webserver will typically use by simply browsing the website with different encryption algo's disabl…

Almost no cryptography being deployed today uses prime numbers. (Not because of any weakness, but because there are better, more efficient algorithms instead.)

RSA is still in wide use in both old and new deployments (e.g. it is still the majority of TLS handshakes).

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.

Re: The Joy of Cryptography

#37
post #16

Earlier quoted context omitted.

It depends on the protocol and mode, but it’s usually transmitted in the clear along with the encrypted message.

Thanks! I thought it had to be somehow not transmitted in the clear.

It can also be implied by some other system parameter. As long as the same IV is never reused for the same key, it's safe. For example, if you're encrypting data blobs in some kind of CDN and you never mutate old blobs, your IV can be the blob ID.

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.

Re: The Joy of Cryptography

#38
post #12

Related question: when using Block Cipher Mode, how does Alice and Bob exchange the IV?

The IV (or the nonce, in an AEAD) is usually public, but authenticated; often just appended to the message; with CBC mode, you'd normally prefix the message with the IV, and include the IV in your HMAC.

Re: The Joy of Cryptography

#40

Earlier quoted context omitted.

Almost no cryptography being deployed today uses prime numbers. (Not because of any weakness, but because there are better, more efficient algorithms instead.)

RSA is still in wide use in both old and new deployments (e.g. it is still the majority of TLS handshakes). 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 alternativ…

No cryptography engineer seriously believes the NIST P-curves are backdoored, and they are in widespread use. Ed25519 is a signing scheme; it isn't a replacement for the RSA in classic TLS --- you'd be thinking of Curve25519, its sibling. The benefit of the 25519s isn't "no magic numbers", it's a structure that makes it easy to implement relatively safely. And all these curves work over prime subfields.

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".

Post reply on HN