python一些加密解密


import hashlib
import base64

data = '123456'
data = data.encode('utf-8')
md5 = hashlib.md5()
md5.update(data)
print ("md5加密 :%s"%md5.hexdigest())
sha1 = hashlib.sha1()
sha1.update(data)
print ("sha1加密: %s"%sha1.hexdigest())
sha224 = hashlib.sha224()
sha224.update(data)
print ("sha224加密: %s"%sha224.hexdigest())
sha256 = hashlib.sha256()
sha256.update(data)
print ("sha256加密: %s"%sha256.hexdigest())
sha384 = hashlib.sha384()
sha384.update(data)
print ("sha384加密: %s"%sha384.hexdigest())
sha512 = hashlib.sha512()
sha512.update(data)
print ("sha512加密: %s"%sha512.hexdigest())
new = hashlib.new('ripemd160')
new.update(data)
print ("new加密: %s"%new.hexdigest())
b = base64.encodestring(data)
c = base64.decodestring(b)
print ("base64加密: %s"%b)
print ("base64解密: %s"%c)
Author: honmaple

NO CONTENTS

lin.jiang

风落花语风落天,花落风雨花落田.