String returns a cryptographically secure random string of characters (taken from randomCharset) of the specified length. The returned string contains ~5.8 bits of entropy per character, due to the character set used.
(l int)
| 38 | // (taken from randomCharset) of the specified length. The returned string |
| 39 | // contains ~5.8 bits of entropy per character, due to the character set used. |
| 40 | func String(l int) string { |
| 41 | var sb strings.Builder |
| 42 | sb.Grow(l) |
| 43 | |
| 44 | for range l { |
| 45 | sb.WriteByte(randomCharset[defaultSecureRand.Intn(len(randomCharset))]) |
| 46 | } |
| 47 | return sb.String() |
| 48 | } |
| 49 | |
| 50 | // Int63 returns a cryptographically secure random int63. |
| 51 | func Int63() int64 { |