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

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

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀