# coding=utf-8
import base64
from hashlib import sha1
sha= sha1()
sha.update(b"aaa"+b"bbb") # 字符串相加等价于两次update
# sha.update(b'bbb')
aa=sha.hexdigest()
str=aa.encode('utf-8')
bs64=base64.b64encode(str)
print(bs64)
#b'NjhkODU3MmMyNjYyYjBmMDZmNzIzZDdkNTA3OTU0ZmIwMzhiODU1OA=='
#b'NjhkODU3MmMyNjYyYjBmMDZmNzIzZDdkNTA3OTU0ZmIwMzhiODU1OA=='