コード例 #1
0
ファイル: crypto_scalarmult.py プロジェクト: hemincong/pynacl
def crypto_scalarmult_base(n):
    """
    Computes and returns the scalar product of a standard group element and an
    integer ``n``.

    :param n: bytes
    :rtype: bytes
    """
    q = lib.ffi.new("unsigned char[]", crypto_scalarmult_BYTES)

    rc = lib.crypto_scalarmult_base(q, n)
    assert rc == 0

    return lib.ffi.buffer(q, crypto_scalarmult_SCALARBYTES)[:]
コード例 #2
0
ファイル: crypto_scalarmult.py プロジェクト: hemincong/pynacl
def crypto_scalarmult_base(n):
    """
    Computes and returns the scalar product of a standard group element and an
    integer ``n``.

    :param n: bytes
    :rtype: bytes
    """
    q = lib.ffi.new("unsigned char[]", crypto_scalarmult_BYTES)

    rc = lib.crypto_scalarmult_base(q, n)
    assert rc == 0

    return lib.ffi.buffer(q, crypto_scalarmult_SCALARBYTES)[:]
コード例 #3
0
def crypto_scalarmult_base(n):
    """
    Computes and returns the scalar product of a standard group element and an
    integer ``n``.

    :param n: bytes
    :rtype: bytes
    """
    q = lib.ffi.new("unsigned char[]", crypto_scalarmult_BYTES)

    if lib.crypto_scalarmult_base(q, n) != 0:
        raise CryptoError(
            "An error occurred while computing the scalar product")

    return lib.ffi.buffer(q, crypto_scalarmult_SCALARBYTES)[:]
コード例 #4
0
ファイル: crypto_scalarmult.py プロジェクト: teepark/pynacl
def crypto_scalarmult_base(n):
    """
    Computes and returns the scalar product of a standard group element and an
    integer ``n``.

    :param n: bytes
    :rtype: bytes
    """
    q = lib.ffi.new("unsigned char[]", crypto_scalarmult_BYTES)

    if lib.crypto_scalarmult_base(q, n) != 0:
        raise CryptoError(
            "An error occurred while computing the scalar product")

    return lib.ffi.buffer(q, crypto_scalarmult_SCALARBYTES)[:]