utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtendKey

func ExtendKey(key []byte, keyLen int) []byte

func Pkcs7Padding

func Pkcs7Padding[T types.DataType](src T, blockSize int) []byte

func Pkcs7UnPadding

func Pkcs7UnPadding[T types.DataType](src T) T

func ToBytes

func ToBytes[T types.DataType](s T) []byte

func ToHexString

func ToHexString[T types.DataType](b T) string

func ToKeyBytes

func ToKeyBytes(key interface{}) ([]byte, error)

func ToString

func ToString[T types.DataType](b T) string

Types

type RandomSizeFunc

type RandomSizeFunc func(len int) ([]byte, error)
var (
	RandomSize RandomSizeFunc = func(len int) ([]byte, error) {
		iv := make([]byte, len)
		if _, err := rand.Read(iv); err != nil {
			return nil, err
		}

		return iv, nil
	}
)

Jump to

Keyboard shortcuts

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