byteutil

package
v1.1.3-proton Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: BSD-3-Clause Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GfnDouble

func GfnDouble(input []byte) []byte

GfnDouble computes 2 * input in the field of 2^n elements. The irreducible polynomial in the finite field for n=128 is x^128 + x^7 + x^2 + x + 1 (equals 0x87) Constant-time execution in order to avoid side-channel attacks

func RightXor

func RightXor(X, Y []byte) []byte

RightXor XORs smaller input (assumed Y) at the right of the larger input (assumed X)

func ShiftBytesLeft

func ShiftBytesLeft(x []byte) []byte

ShiftBytesLeft outputs the byte array corresponding to x << 1 in binary.

func ShiftNBytesLeft

func ShiftNBytesLeft(dst, x []byte, n int)

ShiftNBytesLeft puts in dst the byte array corresponding to x << n in binary.

func SliceForAppend

func SliceForAppend(in []byte, n int) (head, tail []byte)

SliceForAppend takes a slice and a requested number of bytes. It returns a slice with the contents of the given slice followed by that many bytes and a second slice that aliases into it and contains only the extra bytes. If the original slice has sufficient capacity then no allocation is performed.

func XorBytes

func XorBytes(Z, X, Y []byte)

XorBytes assumes equal input length, puts X XOR Y into Z

func XorBytesMut

func XorBytesMut(X, Y []byte)

XorBytesMut assumes equal input length, replaces X with X XOR Y

Types

This section is empty.

Jump to

Keyboard shortcuts

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