Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
UnixStatusSeeds


NAME

UnixStatusSeeds - generate seed sequence from various Unix status informations

SYNOPSIS

TYPE StatusCommandList = POINTER TO StatusCommandListRec;
TYPE StatusCommandListRec = RECORD (Objects.ObjectRec) END;


PROCEDURE CreateList(VAR list: StatusCommandList); PROCEDURE Add(list: StatusCommandList; command: ARRAY OF CHAR);

PROCEDURE Create(VAR sequence: RandomGenerators.Sequence; list: StatusCommandList);

DESCRIPTION

UnixStatusSeeds provides seed values on base of the digested output of chosen commands. The commands should be carefully selected so that their output is hard to predict. MD5 is used to compute the digests. As soon as the digest sum is consumed up, the commands are rerun and a new digest will be computed.

Note that this module serves primarily as a fallback solution if random devices are not available, see SeedStreams. All useful seed generators like this one are expensive to use and ought to be stretched using unpredictable generators like SurfRandomGenerators.

CreateList and Add allow to create and extend a list of commands. These commands shall consist of a full pathname of a binary and a space-separated list of arguments. Meta characters of shells or the environment variable PATH are not considered as the commands are not passed to a shell for interpretation. It does not hurt to try different paths if the exact location is not known (see example). Note however that the standard error of these commands will be shared with the standard error channel of the own process. Hence, it should be avoided to give possibly invalid flags or commands that occasionally fail.

Create creates a sequence that is based upon the list of commands list. Note that the list must not be empty.

DIAGNOSTICS

Error events in the attempts to execute the given commands are related to the sequence. Zeroes are generated in case of failures.

EXAMPLE

Following code snippet demonstrates how a seed sequence can be created that uses the combined output of the ps, date, and netstat command to generate seed values:

VAR seq: RandomGenerators.Sequence;
VAR list: UnixStatusSeeds.StatusCommandList;
(* ... *)
UnixStatusSeeds.CreateList(list);
UnixStatusSeeds.Add(list, "/bin/ps -ef");
UnixStatusSeeds.Add(list, "/usr/bin/ps -ef");
UnixStatusSeeds.Add(list, "/bin/date");
UnixStatusSeeds.Add(list, "/usr/bin/date");
UnixStatusSeeds.Add(list, "/bin/netstat -n");
UnixStatusSeeds.Add(list, "/usr/bin/netstat -n");
UnixStatusSeeds.Create(seq, list);

This example also shows how multiple paths for one command can be given if it is not clear where they are to be found.

SEE ALSO

RandomGenerators
abstraction for sequences of random numbers or seeds
SeedStreams
to be preferred alternative, if supported on the local system
SurfRandomGenerators
good candidate for stretching seed values

Edited by: borchert, last change: 2004/03/08, revision: 1.1, converted to HTML: 2004/03/08

Oberon || Library || Module Index || Search Engine || Definition || Module