Show HN: Diffie-Hellman exchange for the layman
borisreitman.com
borisreitman.com
TLDR: "Without authentication, impersonation is feasible, ..."
For example, TLS 1.3 does this by (after performing ephemeral DH key exchange) signing the conversation transcript with the server's long term identity key. After this the client is sure that they are speaking to the correct server, but the server has no authenticity guarantees about the client.
But there's a difference in terms of strength of the encryption key, if you are planning to use the full password as input to Key Derivation Function (KDF). If you make public the first 5 letters of a 44 letter password, you've just made lost some of the entropy.
By the way, based on a comment in this thread, I added a SHA-256 stage. I now hash the full password, and sum the bytes of the hash to generate the check digits.
given large prime p, some a, some b:
1. A = g^a mod p
2. B = g^b mod p
3. exchange A,B
4. B^a mod p = (g^b)^a mod p = (g^a)^b mod p = A^b mod p is the shared key.
the end
https://www.comparitech.com/blog/information-security/diffie...
that's just multiplication in Z_r...?
edit: alright i guess technically it uses homomorphism from Z to Z_r but you don't need to be able to write out the proof to intuit/believe it
Even allowing that you meant "programmers" originally, "programming" covers a massive field of knowledge sets. For example, I know what exponentiation and modular arithmetic are, but I can't derive the practical implications from your example without further research. I also have no idea what "g" is.
https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exc...
In the case of DH, g is some such element.
I don't think I can explain to a layman without math backround why it is secure. So I have kept it simple.
DH relies on the discrete logarithm problem. That means that if I give you g + g + .. + g, where g is added to itself n times, it will be difficult for you to find out what n is.
Both parties share the same prime p, and the same base point g. Then each of them select a random, secret point. Say Alice's secret is a and Bob's is b. Now each of them create their "public key", which is just g + g + g .. a times, and g + ... b times to create A and B, respectively. The (mod p) simply means divide the result by p and take the remainder as the answer.
Now if I am Alice, my secret is a, my public key is A. Bob sends me B = g^b (mod p). I exponentiate this with my own secret key to get shared secret = (B)^a = (g^b)^a = (g^a)^b = g^(ab) (mod p)
(mod can be deferred to the end of the calculation or done at each step, without changing the answer)
So you can see that, since the order of exponentiation doesn't matter, when Bob does the same calculation (multiplying his private b with alice's public key g^a) he gets the same shared secret.
ECDH has smaller keys because the attacks are (until now) weaker and not because you're using an additive cyclic group.
I think the keys can be smaller because every random coordinate is a valid value (valid key), but in the case of RSA, valid values are more sparse.
A much safer implementation would be to take the sha256 of the key and only show the 2 rightmost bytes.
Thank you!
I just don't think an ugly page can be useful for the layman. It has to be a nice and user friendly page, which means it would have a lot of design loaded as well. Use the "_bare" page if you want to customize it for your needs.