Пример #1
0
def rand_pseudo_bytes(num):
    # type: (int) -> Tuple[bytes, int]
    """
    Return num pseudo-random bytes into buf.

    Pseudo-random byte sequences generated by this method will be unique
    if they are of sufficient length, but 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.

    Output of the function is mixed into the entropy pool before
    retrieving the new pseudo-random bytes unless disabled at compile
    time (see FAQ).

    :param num: number of bytes to be returned
    :return: random bytes
    """
    import warnings
    if m2.OPENSSL_VERSION_NUMBER >= 0x10100000:
        warnings.warn('The underlying OpenSSL method has been ' +
                      'deprecated. Use Rand.rand_bytes instead.',
                      DeprecationWarning)

    return m2.rand_pseudo_bytes(num)  # pylint: disable=no-member
Пример #2
0
def rand_pseudo_bytes(num):
    # type: (int) -> Tuple[bytes, int]
    """
    Return num pseudo-random bytes into buf.

    Pseudo-random byte sequences generated by this method will be unique
    if they are of sufficient length, but 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.

    Output of the function is mixed into the entropy pool before
    retrieving the new pseudo-random bytes unless disabled at compile
    time (see FAQ).

    :param num: number of bytes to be returned
    :return: random bytes
    """
    import warnings
    if m2.OPENSSL_VERSION_NUMBER >= 0x10100000:
        warnings.warn('The underlying OpenSSL method has been ' +
                      'deprecated. Use Rand.rand_bytes instead.',
                      DeprecationWarning)

    return m2.rand_pseudo_bytes(num)  # pylint: disable=no-member