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

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

报告相同问题?

悬赏问题

  • ¥15 vue2中使用计算属性
  • ¥50 远程桌面打开Mastercam、没有许可证、物理机打开正常
  • ¥15 ubuntu安装gdal后java读取tif文件报错
  • ¥15 请问lammps怎么做两种金属连接的原子浓度分布图
  • ¥15 求jacquard数据集
  • ¥15 w10部分软件不能联网
  • ¥15 关于安装hbase的问题(操作系统-windows)
  • ¥15 novnc连接pve虚拟机报错安全协议不支持262
  • ¥15 设备精度0.03给多少公差能达到CPK1.33
  • ¥15 qt+ffmpeg报错non-existing PPS 0 referenced