>>>
import
SHA256
>>>
import
struct
>>>
import
configparser
>>>
import
common
>>>
>>> cf
=
configparser.ConfigParser()
>>> wbc_content
=
common.read_file(
"test.wbc"
).replace(
"\x00"
, "")
>>> cf.read_string(wbc_content)
>>>
>>> h
=
SHA256.SHA256()
>>> h.update(bytes.fromhex(
"17051401040C14020402134414021346"
))
>>> h.update(bytes.fromhex(cf.get(
"Inventory"
,
"nonce"
)))
>>> h.update(bytes.fromhex(cf.get(
"Inventory"
,
"redundancydata"
))[
0
:
33
])
>>> h.update(struct.pack(
"I"
,
int
(cf.get(
"Inventory"
,
"version0"
),
10
)))
>>> h.update(struct.pack(
"I"
,
int
(cf.get(
"Inventory"
,
"version1"
),
10
)))
>>> h.update(struct.pack(
"I"
,
int
(cf.get(
"Inventory"
,
"version2"
),
10
)))
>>> h.update(struct.pack(
"I"
,
int
(cf.get(
"Inventory"
,
"version3"
),
10
)))
>>> h.update(struct.pack(
"I"
,
int
(cf.get(
"Inventory"
,
"Heuristic"
),
10
)))
>>> h.update(struct.pack(
"I"
,
int
(cf.get(
"Inventory"
,
"flags"
),
10
)))
>>>
>>>
for
i
in
range
(cf.getint(
"Inventory"
,
"itemcount"
)):
>>> item_name
=
"Item_%d"
%
i
>>> h.update(bytes.fromhex(cf.get(item_name,
"id"
)))
>>> h.update(struct.pack(
"I"
,
int
(cf.get(item_name,
"position"
),
10
)))
>>> h.update(struct.pack(
"I"
,
int
(cf.get(item_name,
"length"
),
10
)))
>>> h.update(bytes.fromhex(cf.get(item_name,
"params"
)))
>>>
>>> h.update(struct.pack(
"I"
,
int
(cf.get(
"Inventory"
,
"itemcount"
),
10
)))
>>> part2
=
''
>>>
for
i
in
h.final():
>>> part2
+
=
"%x"
%
i
>>>
print
(
"part2: %s"
%
part2)
part2:
57eceb1aa5768647a7ef6b775af2353d45f497321a2d2773ee551f3de35ca5