21 lines
415 B
Go
21 lines
415 B
Go
// Copyright 2014 Docker authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the DOCKER-LICENSE file.
|
|
|
|
package utils
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
"io"
|
|
)
|
|
|
|
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)
|
|
}
|