cryptoutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRandom

func NewRandom(l int) []byte

NewRandom generates a random salt of the specified length and returns it as a Salt type. If an error occurs while generating the salt or the generated salt length does not match the specified length, a panic is raised with an error message.

func Pad

func Pad(data []byte, blockSize int) ([]byte, error)

Pad pads the data to the specified block size, if data is already the right size, this is a no-op

func SecureCompare

func SecureCompare(tag []byte, finish []byte) bool

func SeededRandomData

func SeededRandomData(seed []byte, n int) []byte

func Unpad

func Unpad(data []byte, blockSize int) ([]byte, error)

Types

type Blocker

type Blocker struct {
	// contains filtered or unexported fields
}

func NewBlocker

func NewBlocker(blockSize int, data []byte) *Blocker

func (*Blocker) Next

func (b *Blocker) Next() (int, []byte)

type SeededPRNG

type SeededPRNG struct {
	// contains filtered or unexported fields
}

func NewSeededPRNG

func NewSeededPRNG(seed []byte, discard uint) *SeededPRNG

func (*SeededPRNG) FillBuffer

func (g *SeededPRNG) FillBuffer(buff []byte)

func (*SeededPRNG) GetBytes

func (g *SeededPRNG) GetBytes(n int) []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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