-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_crypto.py
29 lines (19 loc) · 1.11 KB
/
test_crypto.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
# Copyright © 2023-2024, Meheret Tesfaye Batu <[email protected]>
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit
from bip38.crypto import (
ripemd160, sha256, double_sha256, get_checksum, hash160
)
from bip38.utils import get_bytes
def test_crypto(_):
assert isinstance(ripemd160(data=_["crypto"]["data"]), bytes)
assert ripemd160(data=_["crypto"]["data"]) == get_bytes(_["crypto"]["ripemd160"])
assert isinstance(sha256(data=_["crypto"]["data"]), bytes)
assert sha256(data=_["crypto"]["data"]) == get_bytes(_["crypto"]["sha256"])
assert isinstance(double_sha256(data=_["crypto"]["data"]), bytes)
assert double_sha256(data=_["crypto"]["data"]) == get_bytes(_["crypto"]["double_sha256"])
assert isinstance(get_checksum(data=_["crypto"]["data"]), bytes)
assert get_checksum(data=_["crypto"]["data"]) == get_bytes(_["crypto"]["get_checksum"])
assert isinstance(hash160(data=_["crypto"]["data"]), bytes)
assert hash160(data=_["crypto"]["data"]) == get_bytes(_["crypto"]["hash160"])