doushishi6513 2017-02-07 13:10
浏览 106
已采纳

Golang重复Rails Devise gem密码加密

I have to authenticate user in a new app which uses Beego framework for Golang, twist is that DB is from Rails application where authentication is implemented using gem Devise .
I've looked at gem Bcrypt implementation
https://github.com/codahale/bcrypt-ruby/blob/master/lib/bcrypt/password.rb
But can't quite grasp how to replicate encrypted_password to validate user...
Can you please help me ?

UPDATE1
using bcrypt didn't help

b_password := []byte(password)
hashedPassword, err := bcrypt.GenerateFromPassword(b_password, bcrypt.DefaultCost)

I get different passwords.

  • 写回答

1条回答 默认 最新

  • duangou2028 2017-02-08 09:12
    关注

    I found out https://github.com/consyse/go-devise-encryptor exactly for doing this task

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

报告相同问题?