Ai-Thinker-Open_RTL8710BX_A.../tools/asr5501/add_md5.py

13 lines
282 B
Python
Raw Normal View History

2020-06-18 12:06:52 +00:00
import sys, hashlib
def MD5(bytes):
md5 = hashlib.md5()
md5.update(bytes)
return md5.hexdigest().decode('hex')
ota_bin = sys.argv[1]
with open(ota_bin, 'rb') as file:
ota_md5_bytes = MD5(file.read())
with open(ota_bin, 'ab') as file:
file.write(ota_md5_bytes)