Hi All,
If you're in the market for a good 64 bit pseudo random number generator my post in CTF, "So. Many. Passwords." may be of interest. I'm working on an encryption application - if you know something about encryption (I don't) I'd also like to hear your comments.
Best
Dan H.
Random Numbers
Moderators: hgm, Rebel, chrisw
-
- Posts: 5258
- Joined: Mon Feb 27, 2006 4:31 pm
- Location: Atlanta, Georgia
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Random Numbers
Here's mine, proven to be good (real world scenarios):Dan Honeycutt wrote:Hi All,
If you're in the market for a good 64 bit pseudo random number generator my post in CTF, "So. Many. Passwords." may be of interest. I'm working on an encryption application - if you know something about encryption (I don't) I'd also like to hear your comments.
Best
Dan H.
Code: Select all
ULong keys[2];
inline ULong Rotate(ULong v, Byte s) {
return (v >> s) | (v << (64-s));
}
// generate next 64-bit random number
inline ULong Next64()
{
ULong tmp = keys[0];
keys[0] += Rotate(keys[1] ^ 0xc5462216u ^ ((ULong)0xcf14f4ebu<<32), 1);
return keys[1] += Rotate(tmp ^ 0x75ecfc58u ^ ((ULong)0x9576080cu<<32), 9);
}
IV is two 64-bit numbers (keys) so seed with whatever you want.
If your compiler can fold rotations (last time I tried with clang it couldn't), it can generate ~1 billion 64-bit PRN per second on my several years old stock i7 quad (single core).
public domain.
Of course it's not crypto-secure so I'm not sure what you want to accomplish. Generates sequence to xor input data with? Might work as a naive encryption.
-
- Posts: 4190
- Joined: Wed Nov 25, 2009 1:47 am
Re: Random Numbers
https://en.wikipedia.org/wiki/Mersenne_TwisterDan Honeycutt wrote:Hi All,
If you're in the market for a good 64 bit pseudo random number generator my post in CTF, "So. Many. Passwords." may be of interest. I'm working on an encryption application - if you know something about encryption (I don't) I'd also like to hear your comments.
-
- Posts: 12542
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Random Numbers
http://crypto.stackexchange.com/questio ... the-output
Maybe:
http://burtleburtle.net/bob/rand/isaacafa.html
Maybe:
http://burtleburtle.net/bob/rand/isaacafa.html
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
-
- Posts: 5258
- Joined: Mon Feb 27, 2006 4:31 pm
- Location: Atlanta, Georgia
Re: Random Numbers
What I'm working on is a very simple text editor with a password feature to use to store the many passwords you end up with if you are active on the internet. I'm an encryption noob, what advantage would a crypto-secure RNG give, just harder to decrypt?mar wrote:Of course it's not crypto-secure so I'm not sure what you want to accomplish. Generates sequence to xor input data with? Might work as a naive encryption.
Best
Dan H.
-
- Posts: 5258
- Joined: Mon Feb 27, 2006 4:31 pm
- Location: Atlanta, Georgia
Re: Random Numbers
I've read that Kiss is something of an improvement over the Mersenne Twister but I certainly don't know enough to attest one way or the other.Milos wrote:https://en.wikipedia.org/wiki/Mersenne_TwisterDan Honeycutt wrote:Hi All,
If you're in the market for a good 64 bit pseudo random number generator my post in CTF, "So. Many. Passwords." may be of interest. I'm working on an encryption application - if you know something about encryption (I don't) I'd also like to hear your comments.
Best
Dan H.
-
- Posts: 5258
- Joined: Mon Feb 27, 2006 4:31 pm
- Location: Atlanta, Georgia
Re: Random Numbers
Thanks, Dann. I'm still trying to understand if I really need a crypto-secure RNG but if I do your second link looks like a good candidate.Dann Corbit wrote:http://crypto.stackexchange.com/questio ... the-output
Maybe:
http://burtleburtle.net/bob/rand/isaacafa.html
Best
Dan H.
-
- Posts: 12542
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Random Numbers
If you want to handle passwords, you NEED a crypto secure method.Dan Honeycutt wrote:What I'm working on is a very simple text editor with a password feature to use to store the many passwords you end up with if you are active on the internet. I'm an encryption noob, what advantage would a crypto-secure RNG give, just harder to decrypt?mar wrote:Of course it's not crypto-secure so I'm not sure what you want to accomplish. Generates sequence to xor input data with? Might work as a naive encryption.
Best
Dan H.
Especially since users tend to reuse passwords.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
-
- Posts: 411
- Joined: Thu Dec 30, 2010 4:48 am
Re: Random Numbers
When it comes to cryptography there's so many ways to mess it up that you really shouldn't roll your own anyways for anything other than educational purposes - take an existing crypto library, use it as intended. Even your own implementation of an accepted protocol is risky (your implementation may 'work' while not being secure against subtle attacks) - heavily used crypto libraries you at least have the peace of mind that many people are looking for and fixing these vulnerabilities.
-
- Posts: 6052
- Joined: Tue Jun 12, 2012 12:41 pm
Re: Random Numbers
one more thread, when one wonders, especially when posted by a mod, whether it belongs strictly here.
in any case, I see nothing related to computer chess: the use is not intended to tackle building a chess engine and, even if it were so, still the rigth forum would be the programming section.
on the other hand, I find Harvey's London chess classic thread quite acceptable, as people are using engine output to decide on a position.
in any case, I see nothing related to computer chess: the use is not intended to tackle building a chess engine and, even if it were so, still the rigth forum would be the programming section.
on the other hand, I find Harvey's London chess classic thread quite acceptable, as people are using engine output to decide on a position.