go/gin使用bcrypt ITchuan 2021-06-25 1,017 阅读1分钟 go/gin中使用bcrypt加密的方法 1、加密 result,_ := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) 2、比对密码 bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password))