htpasswd java,如何使用java生成像apache的htpasswd这样的哈希

i use "Force MD5 encryption of the password" in htpasswd to generate a hash for instance '123' i get:

use htpasswd: 123 => $apr1$kaTbKaLO$ewJXRZAKpjaxK4thy2jOp/

use MD5 digest: 123 => 202cb962ac59075b964b07152d234b70

please tell me how can i generate a hash like the apache htpasswd using java

Thanks.

解决方案

Passwords in Apache .htpasswd files are encoded using a salt. If you want to generate these passwords using Java you'll need to do the same. This site has an explanation of the salt/hashing algorithm used for Apache's .htpasswd files; I am looking for an actual algorithm you could use and will edit my answer after I find one.

EDIT: Looks like it's been asked before, right here on SO:

Here's the documentation from Apache, along with their source code:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值