Source File
text.go
Belonging Package
crypto/rand
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rand
const base32alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
// Text returns a cryptographically random string using the standard RFC 4648 base32 alphabet
// for use when a secret string, token, password, or other text is needed.
// The result contains at least 128 bits of randomness, enough to prevent brute force
// guessing attacks and to make the likelihood of collisions vanishingly small.
// A future version may return longer texts as needed to maintain those properties.
func () string {
// ⌈log₃₂ 2¹²⁸⌉ = 26 chars
:= make([]byte, 26)
Read()
for := range {
[] = base32alphabet[[]%32]
}
return string()
}
The pages are generated with Golds v0.7.3. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |