News for hackers. Stuff that matters.
Re:Ask HN: What offline encryption methods do you use? by shrimp_emoji on Wednesday May 08, 2019 @02:10PM (#19861427)
>you have your brain, a pen, paper and if you're lucky, a secure destruction mechanism that doesn't immediately raise suspicion.

It would be absurdly difficult, but you could manually implement Diffie-Hellman key exchange to generate a secret with the other party without actually ever communicating it.

Just find a large prime, p (at least 600 digits to be safe).

Then pick an integer g between 1 and p and a random integer x.

Then compute g^x mod p.

Send p, g, and (g^x mod p) to your friend (you can even include these instructions for them -- it won't affect whether this works).

They take your p, g, and (g^x mod p) and choose a random integer y

They compute g^y mod p and send that back to you.

You take their (g^y mod p) and compute (g^y mod p)^x mod p. This equals g^xy mod p.

They take your (g^x mod p) and compute (g^x mod p)^y mod p. This also equals g^xy mod p.

You now share a secure secret key, (g^xy mod p), that you can use for encryption in a cipher. This is secure if you both chose a random x and y, which you never shared, and which any attacker would need in order to derive (g^xy mod p) from the four pieces of information they have: p, g, (g^x mod p), and (g^y mod p). The discrete log problem makes it computationally-infeasible to calculate x or y from those values.

Buuuuut then would come the even harder part: encrypting and decrypting messages (being a human cipher suite) with that secret key. :3 It's just rote math at that point, but... let's hope you have a lot of time and paper.

There are no comments on this comment yet.