upvote
The connection to the parent post is that the 7-line “textbook” version of RSA is the one that’s vulnerable to all kinds of things that aren’t obvious when you sit down to type in those 7 lines.
reply
Not in the slightest. Getting

1. Constant time bigint arithmetic, and

2. The padding scheme (which has had MANY issues over the years)

Done correctly is relatively complicated. But a shitty insecure version of RSA is easy to write.

reply
Not even close.

First, that seven lines of code includes a bignum arithmetic library, but the ones shipped with your language are not constant-time and not suitable in any way, shape, or form for use in cryptographic code.

Then it’s a pain in the ass and slow to encrypt large messages so literally nobody uses RSA to do so. They generate a symmetric key and use that to encrypt the message then use RSA to encrypt the symmetric key.

With both of those you’ve managed to get to a minimally useful but still laughably insecure RSA implementation.

reply