fix: handle hash without $ prefix

This commit is contained in:
Jon Lundy 2022-12-07 18:44:58 -07:00
parent 9e61907d51
commit e00997d616
Signed by untrusted user who does not match committer: xuu
GPG Key ID: C63E6D61F3035024

View File

@ -75,6 +75,10 @@ func (p *Passwd) IsPreferred(hash string) bool {
func (p *Passwd) getAlgo(hash string) (string, Passwder) {
var algo string
if !strings.HasPrefix(hash, "$") {
return p.getName(p.f), p.f
}
if _, h, ok := strings.Cut(hash, "$"); ok {
algo, _, ok = strings.Cut(h, "$")
if !ok {