nbutton23 / zxcvbn-go

zxcvbn password complexity algorithm in golang
MIT License
379 stars 49 forks source link

Return correct seconds to years conversion in scoring.go #40

Closed wneessen closed 1 year ago

wneessen commented 3 years ago

There is a logic error in the crack time conversion to "CrackTimeDisplay" for values that would reflect in years. For example, a value of "2037200406.475" seconds crack time would currently be displayed as "2.0" years, while the actual time would convert to "64.56 years".

This patch fixes the scoring.go's displayTime() function, so that for the above mentioned time, it would report "64.0" years