fix(go.sum): update ResolveSpec dependency to v1.0.87
CI / build-and-test (push) Failing after 1s
Release / release (push) Failing after 19m26s

This commit is contained in:
Hein
2026-06-23 13:17:16 +02:00
parent 0227912325
commit 1adf50e3db
2436 changed files with 1078758 additions and 114 deletions
+30
View File
@@ -0,0 +1,30 @@
// Copyright 2016 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.
package sasl
import (
"encoding/base64"
"io"
)
// Generates a nonce with n random bytes base64 encoded to ensure that it meets
// the criteria for inclusion in a SCRAM message.
func nonce(n int, r io.Reader) []byte {
if n < 1 {
panic("Cannot generate zero or negative length nonce")
}
b := make([]byte, n)
n2, err := r.Read(b)
switch {
case err != nil:
panic(err)
case n2 != n:
panic("Could not read enough randomness to generate nonce")
}
val := make([]byte, base64.RawStdEncoding.EncodedLen(n))
base64.RawStdEncoding.Encode(val, b)
return val
}