From e00997d6168186c463403d8a170f3a7f4c9904a1 Mon Sep 17 00:00:00 2001 From: Jon Lundy Date: Wed, 7 Dec 2022 18:44:58 -0700 Subject: [PATCH] fix: handle hash without $ prefix --- passwd.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/passwd.go b/passwd.go index b66861c..7795940 100644 --- a/passwd.go +++ b/passwd.go @@ -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 {