Re: get hexadecimal hash string for a number
On 9/18/2012 8:27 PM, markspace wrote:
On 9/18/2012 4:58 PM, Arne Vajh?j wrote:
The correct approach is to use a cryptographic secure
RNG to generate a number of random bytes.
I looked up"cryptographic secure" on Wikipedia, and I have to disagree.
The key he's sending is going out as plain text. Cryptographically
secure RNGs are used to generate keys,
Yes and no.
A cryptographic secure RNG is really just an RNG that produces
values that are hard/impossible to predict.
It has an obvious usage for generating cryptography keys.
But it also has other usages.
Hard to guess id's are one of the other.
you never reveal your seed value
or there's no point to the keys either. The UUID is plenty hard to
guess; using a hard-to-guess value that you then send out as plain text
isn't going to improve your security.
It solves the problem it is intended to solve.
The purpose of a confirmation email with a link with such an
id is to verify that the owner of the email account is indeed
the one registering.
You can not ensure that if it is possible for the registering
person to guess the id.
It need to be hard to guess.
Which is what a cryptographic secure RNG provide.
Also, there's human factors to consider as well. "Fake" but valid email
addresses are plenty easy to generate. If someone really wants to use a
bogus address, they just make one, get the link you send them, and then
ignore the email address after that. This whole process is easy to
automate. Hundreds or thousands of fake ID per day can be generated
this way. "Cryptographically secure" doesn't mean much when Alice and
Mallory are the same person. In this case the human factor is a coder
who thinks "cryptographically secure" is going to solve some problem
when it won't.
That is not relevant for what we are discussing.
We are discussing how to send out confirmation emails with links.
Whether that idea brings value or not is another question.
Arne