708 B
708 B
securerandom
Port of Ruby securerandom
module for Golang.
The following functions are implemented.
func RandomBytes(n int) ([]byte, error)
func Base64(n int, padded bool) (string, error)
func UrlSafeBase64(n int, padded bool) (string, error)
func Hex(n int) (string, error)
func Uuid() (string, error)
Sample usage
package main
import (
"fmt"
sr "github.com/tuvistavie/securerandom"
)
func main() {
b, _ := sr.Base64(10, true)
fmt.Println(b)
b, _ = sr.Hex(10)
fmt.Println(b)
b, _ = sr.Uuid()
fmt.Println(b)
}
For more information, check out the documentation of the ruby module.