Copyright (c) 2013-2018 brinkqiang (brink.qiang@gmail.com)
Linux | Mac | Windows |
---|---|---|
- pycrypto
# -*- coding: utf-8 -*-
import pycrypto
rc = pycrypto.CDMRC()
rc.SetKey("123456")
enbuf = rc.Encrypt("hello world")
print(enbuf)
debuf = rc.Decrypt(enbuf)
print(debuf)
md5 = pycrypto.CDMMD5()
print(md5.GetMD5("hello world"))
base64 = pycrypto.CDMBase64()
base64_encode = base64.Base64Encode("hello world")
print(base64_encode)
base64_decode = base64.Base64Decode(base64_encode)
print(base64_decode)
output
皹=钄�改
hello world
5EB63BBBE01EEED093CB22BB8F5ACDC3
aGVsbG8gd29ybGQ=
hello world