Commit af9b4945 authored by ale's avatar ale

Upgrade ai3/go-common (argon2i fixes)

parent 60a8ffc1
Pipeline #7580 passed with stages
in 1 minute and 21 seconds
......@@ -6,6 +6,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"log"
"strconv"
"strings"
......@@ -54,6 +55,16 @@ func NewArgon2WithParams(time, mem uint32, threads uint8) PasswordHash {
return newArgon2PasswordHash(time, mem, threads, &a2Codec{})
}
// NewArgon2Std returns an Argon2i-based PasswordHash that conforms
// to the reference implementation encoding, using default parameters.
func NewArgon2Std() PasswordHash {
return NewArgon2StdWithParams(
defaultArgon2Params.Time,
defaultArgon2Params.Memory,
defaultArgon2Params.Threads,
)
}
// NewArgon2StdWithParams returns an Argon2i-based PasswordHash using
// the specified parameters for time, memory, and number of
// threads. This will use the string encoding ("$argon2$") documented
......@@ -204,5 +215,7 @@ func (*argon2StdCodec) decodeArgon2Hash(s string) (params argon2Params, salt []b
return
}
dk, err = base64.RawStdEncoding.DecodeString(parts[3])
log.Printf("params: %+v", params)
return
}
......@@ -49,11 +49,12 @@ func getRandomBytes(n int) []byte {
// A registry of default handlers for decoding passwords.
var prefixRegistry = map[string]PasswordHash{
"$1$": NewSystemCrypt(),
"$5$": NewSystemCrypt(),
"$6$": NewSystemCrypt(),
"$s$": NewScrypt(),
"$a2$": NewArgon2(),
"$1$": NewSystemCrypt(),
"$5$": NewSystemCrypt(),
"$6$": NewSystemCrypt(),
"$s$": NewScrypt(),
"$a2$": NewArgon2(),
"$argon2i$": NewArgon2Std(),
}
// ComparePassword returns true if the given password matches the
......
......@@ -11,44 +11,44 @@
{
"checksumSHA1": "gQae1gsfGat/VmlQHY9TaiiZGZk=",
"path": "git.autistici.org/ai3/go-common",
"revision": "3e5c304bf9d132bc389e7d168d93dcf1c43c7265",
"revisionTime": "2020-08-23T15:18:38Z"
"revision": "b151964cbeb8f4474c973585417649ee14e4b0c4",
"revisionTime": "2020-08-23T17:45:36Z"
},
{
"checksumSHA1": "PrVrwtr3weyGRa2j+SIYEMjtuvU=",
"path": "git.autistici.org/ai3/go-common/clientutil",
"revision": "3e5c304bf9d132bc389e7d168d93dcf1c43c7265",
"revisionTime": "2020-08-23T15:18:38Z"
"revision": "b151964cbeb8f4474c973585417649ee14e4b0c4",
"revisionTime": "2020-08-23T17:45:36Z"
},
{
"checksumSHA1": "71XnADFH0zmU4hW8deQffXpbDMQ=",
"path": "git.autistici.org/ai3/go-common/ldap",
"revision": "3e5c304bf9d132bc389e7d168d93dcf1c43c7265",
"revisionTime": "2020-08-23T15:18:38Z"
"revision": "b151964cbeb8f4474c973585417649ee14e4b0c4",
"revisionTime": "2020-08-23T17:45:36Z"
},
{
"checksumSHA1": "ETt1H7ZXeT+mOGVuWDvgGBVx98k=",
"path": "git.autistici.org/ai3/go-common/ldap/compositetypes",
"revision": "3e5c304bf9d132bc389e7d168d93dcf1c43c7265",
"revisionTime": "2020-08-23T15:18:38Z"
"revision": "b151964cbeb8f4474c973585417649ee14e4b0c4",
"revisionTime": "2020-08-23T17:45:36Z"
},
{
"checksumSHA1": "TswnetMKZo4KCydKOkzoGrTMwmA=",
"checksumSHA1": "J011m4Yuj/ujUozVyMUCAdEk2fI=",
"path": "git.autistici.org/ai3/go-common/pwhash",
"revision": "3e5c304bf9d132bc389e7d168d93dcf1c43c7265",
"revisionTime": "2020-08-23T15:18:38Z"
"revision": "b151964cbeb8f4474c973585417649ee14e4b0c4",
"revisionTime": "2020-08-23T17:45:36Z"
},
{
"checksumSHA1": "C510IXCxCms4yjWjIu1pbdqPwN4=",
"path": "git.autistici.org/ai3/go-common/tracing",
"revision": "3e5c304bf9d132bc389e7d168d93dcf1c43c7265",
"revisionTime": "2020-08-23T15:18:38Z"
"revision": "b151964cbeb8f4474c973585417649ee14e4b0c4",
"revisionTime": "2020-08-23T17:45:36Z"
},
{
"checksumSHA1": "jRc0JfRUtCr3xxkgwRDVppsSnl0=",
"path": "git.autistici.org/ai3/go-common/unix",
"revision": "3e5c304bf9d132bc389e7d168d93dcf1c43c7265",
"revisionTime": "2020-08-23T15:18:38Z"
"revision": "b151964cbeb8f4474c973585417649ee14e4b0c4",
"revisionTime": "2020-08-23T17:45:36Z"
},
{
"checksumSHA1": "J0QeD9LVccFOejgPKa0td8JD0rY=",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment