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