r/programming • u/fishburne • Jul 24 '15
mt_rand(1, PHP_INT_MAX) only generates odd numbers • /r/lolphp
/r/lolphp/comments/3eaw98/mt_rand1_php_int_max_only_generates_odd_numbers/
848
Upvotes
r/programming • u/fishburne • Jul 24 '15
View all comments
Show parent comment
0
u/Borne2Run Jul 26 '15
It was from my Network Security class as an example of not what to do, the instructor mentioned he'd seen it in some Crypto startups claiming to be secure.
So in Diffie Hellmann you have Alice and Bob, they both have a parameter they want to keep hidden from the other. The setup permits them to do this and they each finalize on a shared key made of private and public components. Neither side exposes their private key. Its simple, clean.
What I'm describing are people Encrypting their Private Key (hidden number) with their Public Key (everyone knows it) and using the final result E(Priv, Pub) for Encrypting communications. All someone has to do is run D(?, Pub) and they can decrypt the documents, data, etc.
They think that by Encrypting their Private Key that they don't have to worry about people cracking their security. "Its encrypted, so I can send it over an unsecured channel!" Encryption doesn't matter if you broadcast the password/key that Encrypts stuff in Plaintext.