securerandom

package
v0.0.0-...-e5bcfb3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64

func Base64(n int, padded bool) (string, error)

func Hex

func Hex(n int) (string, error)

func RandomBytes

func RandomBytes(n int) ([]byte, error)

func UrlSafeBase64

func UrlSafeBase64(n int, padded bool) (string, error)

func Uuid

func Uuid() (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL