1.生成MANIFEST.MF文件
对apk中其他文件计算摘要,并对sha1结果进行base64编码
#! /usr/bin/python2.7
# _*_coding:utf-8_*_
import hashlib
import base64
sha1=hashlib.sha1()
sha1_2=hashlib.sha1()
with open("signed/classes.dex","rb") as fp:
while True:
data=fp.read()
if not data:
break
sha1.update(data)
#print data
print sha1.hexdigest() #输出sha1结果给人看,但是这个方法返回的结果不能直接进行base64编码 这是因为输出结果为了方便查阅转换成了字符串 而不是sha1应该输出的128bit摘要。