hbc/pywii/pywii-tools/addhash.py

12 lines
260 B
Python
Raw Normal View History

2016-11-30 10:57:03 +01:00
#!/usr/bin/env python2
2016-11-23 06:35:12 +01:00
import sys
import re
import pywii as wii
hash = wii.SHA.new(open(sys.argv[2]).read()).digest().encode("hex")
f = open(sys.argv[1], "r")
data = f.read()
f.close()
data = re.sub('@SHA1SUM@', hash, data)
open(sys.argv[3], "w").write(data)