浅析 Antiy Password Mixer 加密原理

江海客(安天实验室首席技术架构师)的《由拖库攻击谈口令字段的加密策略》中简单列出了那些常见于程序员中的错误加密策略,以及一些推荐采用的比较安全的加密策略。同时他也顺带提到了由安天实验室开发的Antiy Password Mixer(算是一种通用的密码加密工具包吧),可供广大开发人员选择。

目前只提供了Python版本,后续还会提供PHP和Ruby版本,如果需要C/C++等其他语言版本的就要付费咯。
简单看了下源码,原理和想像的差不多:

密码密文采用了“sha256(用户名 + 32位随机salt + 密码明文)”,然后与salt以及经过RSA加密后的扩展信息,一同存入Kyoto Cabinet(TC的前身)。

如果硬要存储密码明文的话,会用RSA公钥加密“salt+密码明文”,然后存入KC;必要的时候可用私钥解出密码明文。

另外,在具体算法的选择上也尽可能做到较高安全度,例如hash算法没有选择常用的md5和sha1,而是选择了256bit的sha256;RSA的密钥证书用的是较长的4096位。

搞清楚了原理,大家就能在自己的项目中灵活地去实现了:)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: sass-loader@12.1.0 npm ERR! Found: webpack@3.12.0 npm ERR! node_modules/webpack npm ERR! peer webpack@"^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0" from uglifyjs-webpack-plugin@0.4.6 npm ERR! node_modules/webpack/node_modules/uglifyjs-webpack-plugin npm ERR! uglifyjs-webpack-plugin@"^0.4.6" from webpack@3.12.0 npm ERR! peer webpack@"2 || 3 || 4" from babel-loader@7.1.5 npm ERR! node_modules/babel-loader npm ERR! dev babel-loader@"^7.1.1" from the root project npm ERR! 9 more (extract-text-webpack-plugin, file-loader, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer webpack@"^5.0.0" from sass-loader@12.1.0 npm ERR! node_modules/sass-loader npm ERR! dev sass-loader@"^12.1.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: webpack@5.88.2 npm ERR! node_modules/webpack npm ERR! peer webpack@"^5.0.0" from sass-loader@12.1.0 npm ERR! node_modules/sass-loader npm ERR! dev sass-loader@"^12.1.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! npm ERR! For a full report see: npm ERR! C:\Users\antiy\AppData\Local\npm-cache\_logs\2023-07-18T05_47_37_165Z-eresolve-report.txt npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\antiy\AppData\Local\npm-cache\_logs\2023-07-18T05_47_37_165Z-debug-0.log
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值