Cryptography proof randomizer

This forum is for general developer support questions.

Cryptography proof randomizer

Postby softwarefailure » Sat Nov 11, 2017 2:57 pm

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?
softwarefailure
 
Posts: 80
Joined: Fri Feb 14, 2014 11:29 pm

Re: Cryptography proof randomizer

Postby broadblues » Sat Nov 11, 2017 4:11 pm

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"
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 484
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Cryptography proof randomizer

Postby Raziel » Sat Nov 11, 2017 5:15 pm

It doesn't seem to produce any umlauts in there.

Why is that?
Some sort of ASCII, ISO or UTF restriction?
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
User avatar
Raziel
 
Posts: 770
Joined: Sat Jun 18, 2011 5:00 pm
Location: A haunted Castle somewhere in the Bavarian Mountains

Re: Cryptography proof randomizer

Postby broadblues » Sat Nov 11, 2017 6:23 pm

@Raziel

To produce
ASCII text data instead, use the TEXT switch.


There might be clue in the above text
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 484
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Cryptography proof randomizer

Postby Raziel » Sat Nov 11, 2017 6:53 pm

:blush:

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


Thanks
;-)
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
User avatar
Raziel
 
Posts: 770
Joined: Sat Jun 18, 2011 5:00 pm
Location: A haunted Castle somewhere in the Bavarian Mountains

Re: Cryptography proof randomizer

Postby softwarefailure » Mon Nov 13, 2017 10:08 pm

@broadblues: Thanks for the pointer!
softwarefailure
 
Posts: 80
Joined: Fri Feb 14, 2014 11:29 pm


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 3 guests