2019-04-25 14:38:56 +00:00
|
|
|
from c.storage import Storage as StorageC
|
2023-08-15 15:57:02 +00:00
|
|
|
|
2019-04-25 14:38:56 +00:00
|
|
|
from python.src import prng
|
|
|
|
from python.src.storage import Storage as StoragePy
|
|
|
|
|
|
|
|
test_uid = b"\x67\xce\x6a\xe8\xf7\x9b\x73\x96\x83\x88\x21\x5e"
|
|
|
|
|
|
|
|
|
|
|
|
def init(
|
2023-12-27 22:29:22 +00:00
|
|
|
norcow_class, unlock: bool = False, reseed: int = 0, uid: int = test_uid
|
2019-04-25 14:38:56 +00:00
|
|
|
) -> (StorageC, StoragePy):
|
2023-12-27 22:29:22 +00:00
|
|
|
sp = StoragePy(norcow_class)
|
|
|
|
sc = StorageC(sp.nc.get_lib_name())
|
2023-08-21 08:56:18 +00:00
|
|
|
|
2019-04-25 14:38:56 +00:00
|
|
|
sc.lib.random_reseed(reseed)
|
|
|
|
prng.random_reseed(reseed)
|
|
|
|
for s in (sc, sp):
|
|
|
|
s.init(uid)
|
|
|
|
if unlock:
|
2020-08-14 16:54:44 +00:00
|
|
|
assert s.unlock("")
|
2019-04-25 14:38:56 +00:00
|
|
|
return sc, sp
|
|
|
|
|
|
|
|
|
|
|
|
def memory_equals(sc, sp) -> bool:
|
|
|
|
return sc._dump() == sp._dump()
|