📄 bn_rand.pod
字号:
=pod=head1 NAMEBN_rand, BN_pseudo_rand - generate pseudo-random number=head1 SYNOPSIS #include <openssl/bn.h> int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); int BN_rand_range(BIGNUM *rnd, BIGNUM *range); int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range);=head1 DESCRIPTIONBN_rand() generates a cryptographically strong pseudo-random number ofB<bits> bits in length and stores it in B<rnd>. If B<top> is -1, themost significant bit of the random number can be zero. If B<top> is 0,it is set to 1, and if B<top> is 1, the two most significant bits ofthe number will be set to 1, so that the product of two such randomnumbers will always have 2*B<bits> length. If B<bottom> is true, thenumber will be odd.BN_pseudo_rand() does the same, but pseudo-random numbers generated bythis function are not necessarily unpredictable. They can be used fornon-cryptographic purposes and for certain purposes in cryptographicprotocols, but usually not for key generation etc.BN_rand_range() generates a cryptographically strong pseudo-randomnumber B<rnd> in the range 0 <lt>= B<rnd> E<lt> B<range>.BN_pseudo_rand_range() does the same, but is based on BN_pseudo_rand(),and hence numbers generated by it are not necessarily unpredictable.The PRNG must be seeded prior to calling BN_rand() or BN_rand_range().=head1 RETURN VALUESThe functions return 1 on success, 0 on error.The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.=head1 SEE ALSOL<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>,L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)>=head1 HISTORYBN_rand() is available in all versions of SSLeay and OpenSSL.BN_pseudo_rand() was added in OpenSSL 0.9.5. The B<top> == -1 caseand the function BN_rand_range() were added in OpenSSL 0.9.6a.BN_pseudo_rand_range() was added in OpenSSL 0.9.6c.=cut
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -