Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

randomword(3) [osf1 man page]

randomword(3)						     Library Functions Manual						     randomword(3)

NAME
randomword, randomchars, randomletters - Generate random passwords (Enhanced Security) LIBRARY
Security Library - libsecurity.so SYNOPSIS
int randomchars( char *string, unsigned short int minlen, unsigned short int maxlen, boolean restrict, long seed); int randomletters( char *string, unsigned short int minlen, unsigned short int maxlen, boolean restrict, long seed); int randomword( char *word, char *hyphenated_word, unsigned short int minlen, unsigned short int maxlen, boolean restrict, long seed); PARAMETERS
Points at a user-supplied space to contain a null-terminated password. Specifies the minimum length that a generated word can have. Spec- ifies the maximum length that a generated word can have. Specifies whether restrictions are to be imposed on the generated word. This is a boolean integer, where a non-zero integer indications restrictions and a 0 (zero) indicates no restrictions. Specifies an initial seed for the random number generator. Points at a user-supplied space to contain a null-terminated random pronounceable password. Contains the hyphenated version of the generated word. DESCRIPTION
These functions generate random passwords for use in password selection. All of them are generated by the system, based on seeds and set in the function. Such seeds can be created with the drand48(), rand(), or random() functions. The randomchars() function places a null-terminated password composed of random printable ASCII characters into the string parameter and returns the length of the generated string. The minlen parameter can equal maxlen, but cannot be greater than maxlen, and cannot be nega- tive. The user space preallocated is at least maxlen for string. The smaller minlen and maxlen are, the smaller the selection space of random words. The restrict parameter is 0 (zero) when no restrictions are placed on the generated word. It is nonzero when the words generated pass the tests of the acceptable_password() function. The seed parameter is used by the function only on the first time it is called; the parameter is ignored on subsequent calls. The randomletters() function places a null-terminated password composed of random lower-case letters into the string parameter and returns the length of the generated word. The minlen, maxlen, restrict, and seed parameters are the same as for the randomchars() function. The randomword() function places a null-terminated random pronounceable password into the word parameter and returns the length of the gen- erated word. The minlen, maxlen, restrict, and seed parameters are the same as for the randomchars() and randomletters() functions. The user space preallocated is at least 2*max - 1 for hyphenated_word. NOTES
The password generator relies on a random number generator that produces uniformly distributed integers. Because the password generator invokes the random number generator many times even for one word, the random number generator has to produce a uniform distribution. The period (distinct numbers produced given a particular seed) and number space (range of possible numbers) must both be large. The drand48() functions are used for this purpose. Programs using these functions must be compiled with -lsecurity. FILES
System password file. System group file. RELATED INFORMATION
Functions: acceptable_password(3), drand48(3), rand(3), random(3). Commands: login(1), passwd(1). delim off randomword(3)

Check Out this Related Man Page

rand(3C)						   Standard C Library Functions 						  rand(3C)

NAME
rand, srand, rand_r - simple random-number generator SYNOPSIS
#include <stdlib.h> int rand(void); void srand(unsigned int seed); int rand_r(unsigned int *seed); DESCRIPTION
The rand() function uses a multiplicative congruential random-number generator with period 2^32 that returns successive pseudo-random num- bers in the range of 0 to RAND_MAX (defined in <stdlib.h>). The srand() function uses the argument seed as a seed for a new sequence of pseudo-random numbers to be returned by subsequent calls to rand(). If srand() is then called with the same seed value, the sequence of pseudo-random numbers will be repeated. If rand() is called before any calls to srand() have been made, the same sequence will be generated as when srand() is first called with a seed value of 1. The rand_r() function has the same functionality as rand() except that a pointer to a seed seed must be supplied by the caller. If rand_r() is called with the same initial value for the object pointed to by seed and that object is not modified between successive calls to rand_r(), the same sequence as that produced by calls to rand() will be generated. The rand() and srand() functions provide per-process pseudo-random streams shared by all threads. The same effect can be achieved if all threads call rand_r() with a pointer to the same seed object. The rand_r() function allows a thread to generate a private pseudo-random stream by having the seed object be private to the thread. USAGE
The spectral properties of rand() are limited. The drand48(3C) function provides a better, more elaborate random-number generator. When compiling multithreaded applications, the _REENTRANT flag must be defined on the compile line. This flag should be used only in mul- tithreaded applications. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
drand48(3C), attributes(5), standards(5) SunOS 5.11 19 May 2004 rand(3C)
Man Page