dousui4577 2015-03-10 19:13
浏览 41
已采纳

使用php生成密码哈希

i have a DB of users and their password in encrypted form. I want to let the users log in to the site using the username and password. For authentication i need to know what type of encryption is their so that i can match the entered password with the stored password. I have tried many algorithm but i am not able to workout the encryption mechanism. here is a test case

original password: alvin

Password in DB :f9b0213127225c1c74d6662dee8acca297eff9e0

Password Encryption : sha1_v2.4.

salt: 9j1jyse241v7cw0s8okkssgg448wgcogsggoww0

What i want to do is to create the password in DB from original password.

Any hints on how to convert the original password to the password in DB

P.S the table was created by silverstripe CMS

EDIT:

We are no longer using the silverstripe CMS and are converting our website to a Mobile App. So using silverstripe or its function is not an option. However we are using the member table with all the member's data in it including authentication information.

  • 写回答

1条回答 默认 最新

  • dongou3158 2015-03-11 15:16
    关注

    There's a lot of hate in the OP's comments. But it's misdirected - OP is not trying to decode anything (and has explained it better on the forum: http://www.silverstripe.org/community/forums/migrating-a-site-to-silverstripe/show/101337)

    In short, is trying to authenticate a user from an external source, using SilverStripe's database (so using the Member class directly isn't a thing).

    To provide an actual answer:

    The encryption method is stored on the Member table, which by default is 'blowfish', and can change per user. You need three fields of data:

    • Member.PasswordEncryption
    • Member.Salt
    • Member.Password

    The first defines how to use the second, which then allows the third to be calculated (and thus checked against).

    Reasonably standard stuff. See the classes defined here for more detailed/specific info (cf. "Direct known subclasses"): http://api.silverstripe.org/3.1/class-PasswordEncryptor.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效