random

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package random contains some nifty tools for generating rantom numbers. It was lightly modified from an original blog article by Matt Silverlock (@elithrar@mastodon.social) posted here: https://blog.questionable.services/article/generating-secure-random-numbers-crypto-rand/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64URLEncode

func Base64URLEncode(b []byte) string

Base64URLEncode base64 encodes the given bytes in a URL-safe way

func GenerateBytes

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

GenerateBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateString

func GenerateString(s int) (string, error)

GenerateString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

Types

This section is empty.

Jump to

Keyboard shortcuts

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