Skip to content

Commit fa2aafc

Browse files
committed
Switch to bytes.fromhex everywhere
1 parent 4ea43a2 commit fa2aafc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

utils/testvectors_unlinkable.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"""
2020
__license__ = "Apache 2.0"
2121

22-
from binascii import unhexlify
2322
from datetime import datetime, timezone
2423

2524
from dp3t.protocols.unlinkable import (
@@ -29,8 +28,8 @@
2928
)
3029

3130

32-
SEED0 = b"0000000000000000000000000000000000000000000000000000000000000000"
33-
SEED1 = b"eaa2054637009757b9988b28998209d253eede69345f835bb91b3b333108d229"
31+
SEED0 = "0000000000000000000000000000000000000000000000000000000000000000"
32+
SEED1 = "eaa2054637009757b9988b28998209d253eede69345f835bb91b3b333108d229"
3433

3534

3635
TIME0 = datetime(2020, 4, 10, hour=7, minute=15, tzinfo=timezone.utc)
@@ -41,7 +40,7 @@
4140
def main():
4241
print("## Test vectors computing EphID given a seed ##")
4342
for seed_str in [SEED0, SEED1]:
44-
seed = unhexlify(seed_str)
43+
seed = bytes.fromhex(seed_str)
4544
ephid = ephid_from_seed(seed)
4645

4746
print(" - Seed:", seed.hex())
@@ -55,7 +54,7 @@ def main():
5554
print()
5655

5756
print("\n## Test vector hashed observed EphIDs ##")
58-
ephid = ephid_from_seed(unhexlify(SEED1))
57+
ephid = ephid_from_seed(bytes.fromhex(SEED1))
5958
for time in [TIME0, TIME1, TIME2]:
6059
epoch = epoch_from_time(time)
6160
print(" - EphID:", ephid.hex())

0 commit comments

Comments
 (0)