def crypto_scalarmult(n, p): """ Computes and returns the scalar product of the given group element and an integer ``n``. :param p: bytes :param n: bytes :rtype: bytes """ q = lib.ffi.new("unsigned char[]", crypto_scalarmult_BYTES) rc = lib.crypto_scalarmult(q, n, p) assert rc == 0 return lib.ffi.buffer(q, crypto_scalarmult_BYTES)[:]
def crypto_scalarmult(n, p): """ Computes and returns the scalar product of an integer ``p`` and an integer ``n``. :param n: bytes :param p: bytes :rtype: bytes """ q = lib.ffi.new("unsigned char[]", crypto_scalarmult_BYTES) if lib.crypto_scalarmult(q, n, p) != 0: raise CryptoError( "An error occurred while computing the scalar product") return lib.ffi.buffer(q, crypto_scalarmult_BYTES)[:]