2013-10-23 08:35:26 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/rand"
|
|
|
|
"encoding/hex"
|
2013-11-07 20:19:24 +00:00
|
|
|
"io"
|
2013-10-23 08:35:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func RandomString() string {
|
|
|
|
id := make([]byte, 32)
|
|
|
|
_, err := io.ReadFull(rand.Reader, id)
|
|
|
|
if err != nil {
|
|
|
|
panic(err) // This shouldn't happen
|
|
|
|
}
|
|
|
|
return hex.EncodeToString(id)
|
|
|
|
}
|