コード例 #1
0
def encode_raw_public_key(raw_public_key):
    # type: (Tuple[int, int]) -> bytes
    left, right = raw_public_key
    return b''.join((
        pad32(int_to_big_endian(left)),
        pad32(int_to_big_endian(right)),
    ))
コード例 #2
0
ファイル: datatypes.py プロジェクト: thabaptiser/nofees
 def __bytes__(self):
     # type: () -> bytes
     vb = int_to_byte(self.v)
     rb = pad32(int_to_big_endian(self.r))
     sb = pad32(int_to_big_endian(self.s))
     # FIXME: Enable type checking once we have type annotations in eth_utils
     return b''.join((rb, sb, vb))  # type: ignore
コード例 #3
0
ファイル: signature.py プロジェクト: ownership-labs/DataToken
 def to_bytes_v_hacked(self) -> bytes:
     v = self.v
     if v == 0 or v == 1:
         v += 27
     vb = int_to_byte(v)
     rb = pad32(int_to_big_endian(self.r))
     sb = pad32(int_to_big_endian(self.s))
     # FIXME: Enable type checking once we have type annotations in eth_utils
     return b"".join((rb, sb, vb))  # type: ignore
コード例 #4
0
def compress_public_key(uncompressed_public_key_bytes: bytes) -> bytes:
    x, y = decode_public_key(uncompressed_public_key_bytes)
    if y % 2 == 0:
        prefix = b"\x02"
    else:
        prefix = b"\x03"
    return prefix + pad32(int_to_big_endian(x))
コード例 #5
0
ファイル: ecdsa.py プロジェクト: axiom24/stick-resolution
def encode_raw_public_key(raw_public_key):
    left, right = raw_public_key
    return b''.join((
        pad32(int_to_big_endian(left)),
        pad32(int_to_big_endian(right)),
    ))
コード例 #6
0
ファイル: datatypes.py プロジェクト: fubuloubu/eth-keys
 def to_bytes(self) -> bytes:
     return b''.join(pad32(int_to_big_endian(value)) for value in self.rs)
コード例 #7
0
ファイル: datatypes.py プロジェクト: fubuloubu/eth-keys
 def to_bytes(self) -> bytes:
     vb = int_to_byte(self.v)
     rb = pad32(int_to_big_endian(self.r))
     sb = pad32(int_to_big_endian(self.s))
     return b''.join((rb, sb, vb))
コード例 #8
0
def to_bytes(vrs: Tuple[int, int, int]) -> bytes:
    vb = int_to_byte(vrs[0])
    rb = pad32(int_to_big_endian(vrs[1]))
    sb = pad32(int_to_big_endian(vrs[2]))
    return b''.join((rb, sb, vb))