algorithms

package
v0.0.0-...-18307e5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

component.go

helpers.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesEncrypt

func AesEncrypt(input, key []byte) []byte

AES encryption

func BigByteLen

func BigByteLen(x []byte) *big.Int

func BigCeilingDiv

func BigCeilingDiv(x, y *big.Int) *big.Int

func BigFloorDiv

func BigFloorDiv(x, y *big.Int) *big.Int

BigFloorDiv returns the floor of x / y for big.Int.

func BigMod

func BigMod(x, m *big.Int) *big.Int

BigMod calculates x % m using Euclidean modulus with *big.Int

func BigNUM

func BigNUM(X []byte) *big.Int

NUM - Bit string to big.Int (instead of uint64) to avoid overflow

func BigNUMradix

func BigNUMradix(X []byte, radix uint64) *big.Int

BigNUMradix - Numeral string to big.Int, with the specified radix

func BigPower

func BigPower(x, y *big.Int) *big.Int

func BigSTRmRadix

func BigSTRmRadix(x *big.Int, radix uint64, m int64) []byte

BigSTRmRadix - Representation of a big.Int as a string of m numerals in base `radix`

func BreakInBlocks

func BreakInBlocks(X []byte, blockSize int) ([][]byte, error)

BreakInBlocks splits a byte slice into blocks of a specified size.

func ByteLen

func ByteLen(x []byte) uint64

func CeilingDiv

func CeilingDiv(x, y uint64) uint64

func Decrypt

func Decrypt(key []byte, tweak []byte, X []byte, radix uint64) ([]byte, error)

func Encrypt

func Encrypt(key []byte, tweak []byte, X []byte, radix uint64) ([]byte, error)

func FloorDiv

func FloorDiv(x, y uint64) uint64

func Mod

func Mod(x, m uint64) uint64

func ModInt

func ModInt(x int64, m int64) int64

func NUM

func NUM(X []byte) uint64

NUM - Bit string to uint64 - could be faster by using bit shifting

func NUMradix

func NUMradix(X []byte, radix uint64) uint64

NUMradix - Numeral string to uint64

func NumeralSliceToString

func NumeralSliceToString(numerals []byte, alphabet string) (string, error)

func PRF

func PRF(K []byte, X []byte) ([]byte, error)

func Power

func Power(x, y uint64) uint64

Power - Computes x^y for uint64

func STRmRadix

func STRmRadix(x uint64, radix uint64, m int64) []byte

STRmRadix - Representation of a uint64 as a string of m numerals in base

func StringToNumeralSlice

func StringToNumeralSlice(input, alphabet string) ([]byte, error)

StringToNumeralSlice converts a character string to a slice of numerals (`[]uint64`) based on the specified alphabet. The radix is derived from the length of the alphabet. Returns an error if the input contains characters not in the alphabet.

func XORBytes

func XORBytes(a, b []byte) ([]byte, error)

Xor on byte slices

Types

This section is empty.

Jump to

Keyboard shortcuts

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