Cryptography proof randomizer
-
- Posts: 112
- Joined: Fri Feb 14, 2014 10:29 pm
Cryptography proof randomizer
What's the best way to generate strong random numbers on OS4? It needs to be applicable for cryptography-related contexts so things like srand(time(NULL)) and rand() obviously don't fit because they are never random enough. MorphOS has random.library which does a pretty good job here. Is there an OS4 counterpart or something?
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: Cryptography proof randomizer
AmigaOS 4 has the RANDOM: device
NAME
random_handler -- Pseudo-random data generator (V51)
SYNOPSIS
Open("RANDOM:[TEXT/LINELENGTH=<Number>/SIZE=<Number>]",...);
FUNCTION
Random-Handler generates a contiguous stream of data using a
pseudo-random number generator based upon the SHA-256 cryptographic
hash function. The generator is reseeded regularly using the
timer.device entropy gathering process.
The RANDOM: device defaults to generate binary data. To produce
ASCII text data instead, use the TEXT switch. To limit the lengths
of the text lines produced, use the LINELENGTH=<Number> option.
By default, the RANDOM: device will generate a neverending stream
of data. You can limit the amount of data produced with the
SIZE=<Number> option.
PACKETS
ACTION_FINDINPUT
ACTION_READ
ACTION_END
ACTION_IS_FILESYSTEM
NOTE
Access to the RANDOM: device is read-only.
EXAMPLES
Produce 500 bytes of binary data; print the data with the
"Type" shell command:
1> Type "RANDOM:SIZE=500" HEX
Produce 80 characters; print the text with the "Type" shell
command:
1> Type "RANDOM:TEXT/SIZE=80"
Produce text characters, 80 characters per line; print the text
with the "Type" shell command:
1> Type "RANDOM:TEXT/LINELENGTH=80"
Re: Cryptography proof randomizer
It doesn't seem to produce any umlauts in there.
Why is that?
Some sort of ASCII, ISO or UTF restriction?
Why is that?
Some sort of ASCII, ISO or UTF restriction?
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: Cryptography proof randomizer
@Raziel
There might be clue in the above textTo produce
ASCII text data instead, use the TEXT switch.
Re: Cryptography proof randomizer
Well...uh, is that the time...gotta run
Thanks
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
-
- Posts: 112
- Joined: Fri Feb 14, 2014 10:29 pm
Re: Cryptography proof randomizer
@broadblues: Thanks for the pointer!