
밑바닥부터 시작하는 비트코인
368
>>> print(priv.wif(compressed=True, testnet=False))
KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgiuQJv1h8Ytr2S53a
연습문제
4.7
bytes
형 매개변수를 받아 리틀엔디언으로 읽어서 정수를 반환하는
little
_
endian
_
to
_
int
함
수를 작성하시오.
def little_endian_to_int(b):
'''little_endian_to_int takes byte sequence as a little-endian number.
Returns an integer’’’
return int.from_bytes(b, ‘little’)
연습문제
4.8
[연습문제
4
.
7
]의 역과정으로 정수를 매개변수로 받아 리틀엔디언으로
bytes
형 값을 반환하는
int
_
to
_
little
_
endian
함수를 작성하시오.
def int_to_little_endian(n, length):
'''int_to_little_endian takes an integer and returns the little-endian
byte sequence of length'''
return n.to_bytes(length, 'little')
연습문제
4.9
여러분만이 아는 긴 비밀키로 테스트넷 주소를 ...