summaryrefslogtreecommitdiff
path: root/pwned.go
diff options
context:
space:
mode:
authorMarkus Krogh <markus@nordu.net>2018-11-02 13:38:20 +0100
committerMarkus Krogh <markus@nordu.net>2018-11-02 13:38:20 +0100
commitb0864b66daa7e25df42f9b33e999ecfac70faa21 (patch)
treef10dea57fd508e333b11dfd98c22e179b3eea2cd /pwned.go
parent2fa87628ed738f6bf4be2bf0e3285402b32ebd0f (diff)
Bump go version + ubuntu. Fix pwned length
Diffstat (limited to 'pwned.go')
-rw-r--r--pwned.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pwned.go b/pwned.go
index a965c4d..c6083b8 100644
--- a/pwned.go
+++ b/pwned.go
@@ -29,11 +29,11 @@ func NewPWDB(fn string) (*pwdb, error) {
return nil, err
}
- const rs = 63 // V2 has fixed width of 63 bytes
+ const hash_length = 40 // sha1 is 40 chars
+ const rs = hash_length + 1 // sha1 + newline
if stat.Size()%rs != 0 {
- return nil, fmt.Errorf("Unexpected password file format (must be a text file with 63 char width starting with sha1)")
+ return nil, fmt.Errorf("Unexpected password file format (must be a text file with only sha1 + newline)")
}
- const hash_length = 40 // sha1 is 40 chars
return &pwdb{f, int(stat.Size() / rs), rs, hash_length}, nil
}