More updates on documentation

This commit is contained in:
Harshavardhana
2015-02-23 17:44:55 -08:00
parent 2b8adef454
commit 5e1e5ad786
8 changed files with 58 additions and 14 deletions

View File

@@ -21,9 +21,14 @@ import (
"encoding/base64"
)
// Static alphaNumeric table used for generating unique keys
var alphaNumericTable = []byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
var alphaNumericTableFull = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
/// helpers
// Generate random alpha numeric value using only uppercase characters
// takes input as size in integer
func GetRandomAlphaNumeric(size int) ([]byte, error) {
alpha := make([]byte, size)
_, err := rand.Read(alpha)
@@ -37,6 +42,8 @@ func GetRandomAlphaNumeric(size int) ([]byte, error) {
return alpha, nil
}
// Generate random alpha numeric value using all alphanumeric characters
// takes input as size in integer
func GetRandomAlphaNumericFull(size int) ([]byte, error) {
alphaFull := make([]byte, size)
_, err := rand.Read(alphaFull)
@@ -49,6 +56,7 @@ func GetRandomAlphaNumericFull(size int) ([]byte, error) {
return alphaFull, nil
}
// Generate random base64 numeric value from a random seed.
func GetRandomBase64(size int) ([]byte, error) {
rb := make([]byte, size)
_, err := rand.Read(rb)