Page 1 of 1

Cryptography proof randomizer

Posted: Sat Nov 11, 2017 1:57 pm
by softwarefailure
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?

Re: Cryptography proof randomizer

Posted: Sat Nov 11, 2017 3:11 pm
by broadblues
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

Posted: Sat Nov 11, 2017 4:15 pm
by Raziel
It doesn't seem to produce any umlauts in there.

Why is that?
Some sort of ASCII, ISO or UTF restriction?

Re: Cryptography proof randomizer

Posted: Sat Nov 11, 2017 5:23 pm
by broadblues
@Raziel
To produce
ASCII text data instead, use the TEXT switch.
There might be clue in the above text

Re: Cryptography proof randomizer

Posted: Sat Nov 11, 2017 5:53 pm
by Raziel
:blush:

Well...uh, is that the time...gotta run


Thanks
;-)

Re: Cryptography proof randomizer

Posted: Mon Nov 13, 2017 9:08 pm
by softwarefailure
@broadblues: Thanks for the pointer!