util.go 370 B

1234567891011121314151617
  1. package main
  2. import (
  3. "math/rand"
  4. )
  5. const randCharset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
  6. const allRandCharsetLen = len(randCharset)
  7. func newServerRandomness() (serverRandomness string) {
  8. // H2ulzLlh7E0=
  9. b := make([]byte, 11)
  10. for i := 0; i < 11; i++ {
  11. b[i] = randCharset[rand.Intn(allRandCharsetLen)]
  12. }
  13. return string(b) + "="
  14. }