crypto

package module
v0.0.0-...-ed2156f Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: BSD-3-Clause Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DefaultHashSize int = 32
)

Variables

View Source
var (
	Encoder Encoding = defaultEncoder
	Decoder Decoding = defaultDecoder
)
View Source
var (
	EncoderTXT EncodingTXT = defaultEncoderTXT
	DecoderTXT DecodingTXT = defaultDecoderTXT
)

Functions

func Derive

func Derive(secret, salt []byte, size int) ([]byte, error)

Derive returns a derivation of the given secret and salt in a key byte slice of length size.

func Hash

func Hash(data []byte) ([]byte, error)

Hash returns a hash value of data in the length of size.

func HashMAC

func HashMAC(key []byte) hash.Hash

HashMAC takes a key and uses blake2b.

func Nonce

func Nonce() ([]byte, error)

Nonce returns a unique time-based random value to use with XChaCha20.

func Random

func Random(amount uint64) ([]byte, error)

Random returns a byte slice with the given amount of random bytes.

Types

type Compression

type Compression func(in io.Reader, out io.Writer) error
var (
	Compressor   Compression = nil
	Decompressor Compression = nil
)

type Decoding

type Decoding func(code []byte) []byte

type DecodingTXT

type DecodingTXT func(v []byte) []byte

type Encoding

type Encoding func(key []byte) []byte

type EncodingTXT

type EncodingTXT func(v []byte) []byte

type Hashing

type Hashing func(data []byte) ([]byte, error)

Hashing is taking data and returning a byte slice of it in the length of DefaultHashSize.

var (
	// Hasher is the default method to hash data.
	Hasher Hashing = defaultHasher
)

Directories

Path Synopsis
ecdh25519 module
key module
object module
ssh module
stream module

Jump to

Keyboard shortcuts

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