MCPcopy Create free account
hub / github.com/ccxt/ccxt / to_bytes

Function to_bytes

python/ccxt/static_dependencies/starkware/crypto/utils.py:26–45  ·  view source on GitHub ↗

Converts the given integer to a bytes object of given length and byte order. The default values are 32B width (which is the hash result width) and 'big', respectively.

(
    value: int,
    length: Optional[int] = None,
    byte_order: Optional[Endianness] = None,
    signed: Optional[bool] = None,
)

Source from the content-addressed store, hash-verified

24TComparable = TypeVar("TComparable", bound="Comparable")
25
26def to_bytes(
27 value: int,
28 length: Optional[int] = None,
29 byte_order: Optional[Endianness] = None,
30 signed: Optional[bool] = None,
31) -> bytes:
32 """
33 Converts the given integer to a bytes object of given length and byte order.
34 The default values are 32B width (which is the hash result width) and 'big', respectively.
35 """
36 if length is None:
37 length = HASH_BYTES
38
39 if byte_order is None:
40 byte_order = "big"
41
42 if signed is None:
43 signed = False
44
45 return int.to_bytes(value, length=length, byteorder=byte_order, signed=signed)
46
47
48def from_bytes(

Callers 1

pedersen_hash_funcFunction · 0.70

Calls 1

to_bytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…