@mistake
2017-12-05T11:16:52.000000Z
字数 310
阅读 298
未分类
## Hash a file
## Keccak 是课堂派对应文件
import Keccak
import sys
import time
filePath = sys.argv[1]
with open(filePath, "rb") as f :
hexString = f.read().hex()
M = [len(hexString), hexString]
timeBegin = time.clock();
kk = Keccak.Keccak()
res = kk.Keccak(M)
print(res)
timeEnd = time.clock();
print("\nTime Cost(ms) : ")
print(1000 * (timeEnd - timeBegin));