![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python 加解密
a_shen_ge
ashen
展开
-
Python3 学习加解密 系列 1 --Base
Base 家族import base64加密b64,b32,b16,b85 用法一致encrypt_data = base64.b64encode(data.encode()) print(encrypt_data)#默认传入一个参数,第二个参数altchars 字节型的两个任意字母,替换+/ 为了某些特定需要要其实: base64.b64encode(bytes,b'...原创 2018-09-28 10:43:02 · 229 阅读 · 0 评论 -
Python3 学习加解密系列 3 - hashlib
老方法,先help()一下 看一下情况。根据需要网上查资料学习。hexdigest() 仅包含16进制的字符返回import hashlibdata = 'test./+=深'cipher = hashlib.md5(data.encode()).hexdigest()print(cipher)digest() 以二进制数据字符串的形式 由于py3内部处理变成 unicode...原创 2018-09-28 22:29:42 · 1878 阅读 · 2 评论 -
Python3 学习加解密 系列 4 --Cryptodome -Cipher-AES
由于Crypto 安装 麻烦,选择了和它一样项目的Cryptodome包直接 pip install pycryptodome 就行先help 发现 有多种加密方式:看 Cryptodome 源码 有很多功能先看第一个AES:了解下 AES的加密模式:https://blog.csdn.net/icelikejia/article/details/78910804Random.ne...原创 2018-09-29 14:14:38 · 7318 阅读 · 0 评论 -
Python3 学习加解密 系列 4 --Cryptodome -Cipher-DES
DES感觉和AES 一个套路,可以参照我上一篇文章:https://blog.csdn.net/qq_38063791/article/details/82891177ECB:CTR原创 2018-09-29 15:36:07 · 2138 阅读 · 0 评论 -
Python3 学习加解密系列 2 - 关于字符串的那些事(不完整)
1.str 和 hex 互转:转为 hexmessage = 'nice shooting'test = ''.join([ hex(ord(num)).replace('0x','') for num in message ]转为txtmessage = hextest =''.join([chr(int(message[num:num+2],base=16)) for...原创 2018-09-28 21:11:12 · 329 阅读 · 0 评论 -
Python3 学习加解密 系列 4 --Cryptodome -Cipher-3DES
3DES 用 上一篇 DES 没用过的模式吧:OFB:CFB:CBC:PS:其实大概了解了这几种 模式,就好理解了。。。。原创 2018-09-29 16:43:47 · 1154 阅读 · 0 评论 -
Python3 学习加解密 系列 5 --RSA
老方法先进源码 看 有哪些功能:看help() 有点懵,直接 看官方文档 https://stuvel.eu/python-rsa-doc/官网说 可以通过 OpenSSL 创建这些 更快,首先创建密钥对,公钥和私钥,注意文件必须按照pem格式来 接着直接上官网中也说了,RSA只能够加密比密钥小的消息。顺着看到 sign() 加上签名的函数,https://stuvel....原创 2018-09-30 00:17:40 · 312 阅读 · 0 评论