常见编码和加密(python和JavaScript使用示例)

查看 39|回复 0
作者:天空宫阙   
常见编码和加密
编码
ASCII码
Base64
Hex

Base64 Hex 对二进制数据的一种编码方式,不属于加密,但加密后一般需要对数据进行编码Base64 Hex比较常见。

信息摘要(哈希)
md5
import hashlib
m = hashlib.md5()
m.update('hello world'.encode('utf-8'))
print(m.hexdigest())
const CryptoJS = require("crypto-js");
console.log(CryptoJS.MD5('hello world').toString())
SHA1
SHA256

SHA1 SHA256 也可分别使用python的hashlib库和JavaScript的crypto-js实现,使用方法类似

加密
AES加密
DES加密
[table]
[tr]
[td]算法[/td]
[td]密钥长度[/td]
[td]工作模式[/td]
[td]填充模式[/td]
[/tr]
[tr]
[td]AES

示例, 摘要

您需要登录后才可以回帖 登录 | 立即注册

返回顶部