对称加密算法:
- AEAD_AES_256_GCM
- AEAD_CHACHA20_POLY1305
一般用于保存用户资料等信息,加密之后的数据可以完全解密。
用法示例:
https://github.com/Spomky-Labs/php-aes-gcm
https://github.com/cryptosphere/rbnacl/wiki/Secret-Key-Encryption
单向加密算法:
- Argon2
- bcrypt
- scrypt
- PBKDF2
以上算法可用于保存密码等用途,请停止使用 md5,sha1 等算法保存密码。
哈希算法
- Blake2b 比 SHA3,SHA2 快
- Whirlpool ISO/IEC 10118-3:2004
- Streebog-512 俄罗斯标准 RFC 6986
- RIPEMD-160 欧洲标准 ISO/IEC 10118-3:2004
- SHAKE256
- SHA3-512
非对称加密
- NaCL
- X25519 x25519-xsalsa20-poly1305
- ECDHE aka. EECDH
- RSA-OAEP with SHA256,指数使用 65537
认证
- Poly1305 MAC
加密
- XSalsa20 xsalsa20-poly1305
- Camellia
- Kuznyechik
- Serpent
- Twofish
- 组合算法 Kuznyechik-Serpent-Camellia
签名
- ed25519
随机数
从 /dev/urandom 中产生。
ref:
https://gist.github.com/byronhe/232d22f1d3dcaa0a20cb
http://gad.qq.com/article/detail/5430
https://cryptography.io/en/latest/hazmat/primitives/asymmetric/x25519/
https://eleet.im/
网友评论