maybe this is the wrong forum for this, but I think it depends heavily to algorithms...

Are there any good algorithms / Asm-Sources for producing (kind of) REAL random numbers ?

Usage for example for some crypto-topics.

My problem:

I want to produce a file with random 0 and 1, these numbers have to be statisticly really randomized (so a statistic analysis will not be makeable)

Some procedures depends on CPU stuff or HD sectors.

Does anybody have a good resource or idea ?

thx,

Zero

Are there any good algorithms / Asm-Sources for producing (kind of) REAL random numbers ?

Usage for example for some crypto-topics.

My problem:

I want to produce a file with random 0 and 1, these numbers have to be statisticly really randomized (so a statistic analysis will not be makeable)

Some procedures depends on CPU stuff or HD sectors.

Does anybody have a good resource or idea ?

thx,

Zero

I doubt any of the random algorithms on this board can be called

cryptographically safe, readiosys. They might be okay for general

use, but I wouldn't depend on them if security was very important.

cryptographically safe, readiosys. They might be okay for general

use, but I wouldn't depend on them if security was very important.

thx Readiosys

I knew this thread....

and I agree with f0dder, I am not sure that these algorithms can resist a statistic-analysis-attack

but thx anyway :)

Zero

I knew this thread....

and I agree with f0dder, I am not sure that these algorithms can resist a statistic-analysis-attack

but thx anyway :)

Zero

I didn't have time to read the whole post...

agner fog has some things about random number, go check it... maybe it is what you want...

agner fog has some things about random number, go check it... maybe it is what you want...

yep. I check them at the moment...

I forgot one thing to mention:

sure this is a win 32asm board, but interesting will be to make the number-production working on Linux too

Zero

I forgot one thing to mention:

sure this is a win 32asm board, but interesting will be to make the number-production working on Linux too

Zero

Zero,

I don't know if you're looking for random numbers, or random *bits*. Your original post seemed to indicate that you needed "random 0 or 1".

Anyways, I stole this from Numerical Recipes. It's based on the "primitive polynomials modulo 2" method. I'm not sure how "random" this is statistically, but the author claims it'll generate 2^31-1 random bits before it repeats. It seems sort of a suspicious claim for such a simple algo... Furthermore, as F0dder said earlier, I doubt that this is cryptography worthy. But maybe you can pass it through some kind of shuffle routine to fix it up a little better

The book provides formulas for longer sequences too..

--Chorus

I don't know if you're looking for random numbers, or random *bits*. Your original post seemed to indicate that you needed "random 0 or 1".

Anyways, I stole this from Numerical Recipes. It's based on the "primitive polynomials modulo 2" method. I'm not sure how "random" this is statistically, but the author claims it'll generate 2^31-1 random bits before it repeats. It seems sort of a suspicious claim for such a simple algo... Furthermore, as F0dder said earlier, I doubt that this is cryptography worthy. But maybe you can pass it through some kind of shuffle routine to fix it up a little better

```
```

iseed dd ?

;use a normal RNG to set iseed to anything but zero

;return the bit in eax. Save the seed for next time

RandomBits PROC uses edx

mov eax,iseed

rol eax,1

sbb edx,edx

and edx,18

xor eax,edx

mov iseed,eax

and eax,1

ret

RandomBits ENDP

The book provides formulas for longer sequences too..

--Chorus

i think using a good random number generator and starting every file with another seed and shuffel it with a password will make it secure enough to resist against statistic analysis attacks.

chorus,

even bits "0" and "1" are numbers.

If you produce random number, you can set ranges for example from 1..100 or 1..25.

So "bits" are just a different range from 0..1 with full values (no 0.1124... or like this)

but I check the algorithm out...

thx

Zero

even bits "0" and "1" are numbers.

If you produce random number, you can set ranges for example from 1..100 or 1..25.

So "bits" are just a different range from 0..1 with full values (no 0.1124... or like this)

but I check the algorithm out...

thx

Zero

Zero,

depending on your application, different algorithms work differently. For example, the above bit algorithm is good for random *bits* but *not* for random numbers in general. So I wouldn't advise using it if you need a range of numbers.

Conversely, most algos for ranges of random numbers (take for instance a linear congruential) are not good for generating bits. That's why I made the distinction. Furthermore, even a linear congruential RNG (considered probably the simplest and fastest RNG) is not as fast as the algo above on a per-call basis.

If you want to look into more complicated algos, check out numerical recipes. (http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf.html)

What's nice is that now it's online and free, and it's got some great information. They, in turn, refer people to Knuth -- but he's pretty much de facto when it comes to mathematical algorithms.

I'm not an expert in these things by far... but they are.

--Chorus

depending on your application, different algorithms work differently. For example, the above bit algorithm is good for random *bits* but *not* for random numbers in general. So I wouldn't advise using it if you need a range of numbers.

Conversely, most algos for ranges of random numbers (take for instance a linear congruential) are not good for generating bits. That's why I made the distinction. Furthermore, even a linear congruential RNG (considered probably the simplest and fastest RNG) is not as fast as the algo above on a per-call basis.

If you want to look into more complicated algos, check out numerical recipes. (http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf.html)

What's nice is that now it's online and free, and it's got some great information. They, in turn, refer people to Knuth -- but he's pretty much de facto when it comes to mathematical algorithms.

I'm not an expert in these things by far... but they are.

--Chorus

thx, i downloaded the complete book.

hmm... will take some time to read all.

But hx for your advice :)

Zero

hmm... will take some time to read all.

But hx for your advice :)

Zero