gPanel/pkg/encryption/random_string.go
2017-11-03 17:18:26 -05:00

19 lines
332 B
Go

// Encryption package has functions inside of it that utilize various encypting and hashing techniques
package encryption
import (
"crypto/rand"
"fmt"
)
func RandomString() (string, error) {
n := 5
b := make([]byte, n)
if _, err := rand.Read(b); err != nil {
return "", err
}
s := fmt.Sprintf("%X", b)
return s, nil
}