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 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退