Skip to content

Commit

Permalink
Fix: bcrypt ignoring rounds-parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimanyu003 committed May 26, 2024
1 parent 9b2eb43 commit 41d0dde
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions processors/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,17 @@ func (p Bcrypt) Alias() []string {
}

func (p Bcrypt) Transform(data []byte, f ...Flag) (string, error) {
var rounds int
var rounds uint
for _, flag := range f {
if flag.Short == "r" {
r, ok := flag.Value.(int)
r, ok := flag.Value.(uint)
if ok {
rounds = r
}
}
}

bytes, err := bcrypt.GenerateFromPassword(data, rounds)
bytes, err := bcrypt.GenerateFromPassword(data, int(rounds))

return string(bytes), err
}
Expand Down

0 comments on commit 41d0dde

Please sign in to comment.