Manual Pages for UNIX Darwin command on man BN_pseudo_rand
MyWebUniversity

Manual Pages for UNIX Darwin command on man BN_pseudo_rand

BNrand(3) OpenSSL BNrand(3)

NAME

BNrand, BNpseudorand - generate pseudo-random number

SYNOPSIS

#include

int BNrand(BIGNUM *rnd, int bits, int top, int bottom); int BNpseudorand(BIGNUM *rnd, int bits, int top, int bottom); int BNrandrange(BIGNUM *rnd, BIGNUM *range); int BNpseudorandrange(BIGNUM *rnd, BIGNUM *range);

DESCRIPTION

BNrand() generates a cryptographically strong pseudo-random number of

bbiittss bits in length and stores it in rrnndd. If ttoopp is -1, the most

significant bit of the random number can be zero. If ttoopp is 0, it is set to 1, and if ttoopp is 1, the two most significant bits of the number will be set to 1, so that the product of two such random numbers will always have 2*bbiittss length. If bboottttoomm is true, the number will be odd.

BNpseudorand() does the same, but pseudo-random numbers generated by

this function are not necessarily unpredictable. They can be used for

non-cryptographic purposes and for certain purposes in cryptographic

protocols, but usually not for key generation etc.

BNrandrange() generates a cryptographically strong pseudo-random

number rrnndd in the range 0 = rrnndd < rraannggee. BNpseudorandrange() does the same, but is based on BNpseudorand(), and hence numbers generated by it are not necessarily unpredictable. The PRNG must be seeded prior to calling BNrand() or BNrandrange().

RETURN VALUES

The functions return 1 on success, 0 on error. The error codes can be obtained by ERRgeterror(3).

SEE ALSO

bn(3), ERRgeterror(3), rand(3), RANDadd(3), RANDbytes(3) HISTORY BNrand() is available in all versions of SSLeay and OpenSSL.

BNpseudorand() was added in OpenSSL 0.9.5. The ttoopp == -1 case and the

function BNrandrange() were added in OpenSSL 0.9.6a. BNpseudorandrange() was added in OpenSSL 0.9.6c.

0.9.7l 2002-09-25 BNrand(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™