sioutil

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 3 Imported by: 41

Documentation

Overview

Package sioutil implements some I/O utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRandom added in v0.3.0

func MustRandom(n int) []byte

MustRandom returns n randomly generated bytes. It panics if it fails to read n random bytes from its entropy source.

MustRandom uses crypto/rand.Reader as cryptographically secure random number generator (CSPRNG).

func NativeAES added in v0.3.0

func NativeAES() bool

NativeAES returns true when the executing CPU provides AES-GCM hardware instructions and an optimized assembler implementation is available.

It is strongly recommended to only use AES-GCM when NativeAES() returns true. Otherwise, the AES-GCM implementation may be vulnerable to timing attacks. See: https://golang.org/pkg/crypto/aes

func NopCloser

func NopCloser(w io.Writer) io.WriteCloser

NopCloser returns a WriteCloser that wraps w and implements Close as a no-op.

func Random added in v0.3.0

func Random(n int) (b []byte, err error)

Random returns n randomly generated bytes if and only if err == nil.

Random uses crypto/rand.Reader as cryptographically secure random number generator (CSPRNG).

Types

This section is empty.

Jump to

Keyboard shortcuts

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