cic-contracts/util/calculate_erc165.py

18 lines
327 B
Python
Raw Normal View History

2020-12-29 21:51:37 +01:00
import sys
import web3
f = open(sys.argv[1], 'r')
z = b''
for i in range(32):
z += b'\x00'
while True:
l = f.readline()
if l == '':
break
2021-01-02 08:49:32 +01:00
#print('line {}'.format(l))
2020-12-29 21:51:37 +01:00
h = web3.Web3.keccak(text=l)
z = bytes([a ^ b for a, b in zip(h, z)])
2021-01-02 08:49:32 +01:00
#print(h.hex(), z.hex())
2020-12-29 21:51:37 +01:00
f.close()
2021-01-02 08:49:32 +01:00
print(h[:4].hex())