All Projects → danhper → securerandom

danhper / securerandom

Licence: other
No description, website, or topics provided.

Programming Languages

go
31211 projects - #10 most used programming language

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].