internal

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotOnCurve           = fmt.Errorf("point not on the curve")
	ErrPointsDistinctCurves = fmt.Errorf("points must be from the same curve")
	ErrZmMembership         = fmt.Errorf("x ∉ Z_m")
	ErrResidueOne           = fmt.Errorf("value must be 1 (mod N)")
	ErrNCannotBeZero        = fmt.Errorf("N cannot be 0")
	ErrNilArguments         = fmt.Errorf("arguments cannot be nil")
	ErrZeroValue            = fmt.Errorf("arguments cannot be 0")
	ErrInvalidRound         = fmt.Errorf("invalid round method called")
	ErrIncorrectCount       = fmt.Errorf("incorrect number of inputs")
	ErrInvalidJson          = fmt.Errorf("json format does not contain the necessary data")
)

Functions

func B10

func B10(s string) *big.Int

B10 creating a big.Int from a base 10 string. panics on failure to ensure zero-values aren't used in place of malformed strings.

func BigInt2Ed25519Point

func BigInt2Ed25519Point(y *big.Int) (*edwards25519.Point, error)

func BigInt2Ed25519Scalar

func BigInt2Ed25519Scalar(x *big.Int) (*edwards25519.Scalar, error)

func ByteSub

func ByteSub(b []byte)

ByteSub is a constant time algorithm for subtracting 1 from the array as if it were a big number. 0 is considered a wrap which resets to 0xFF

func CalcFieldSize

func CalcFieldSize(curve elliptic.Curve) int

func Hash

func Hash(info []byte, values ...[]byte) ([]byte, error)

Hash computes the HKDF over many values iteratively such that each value is hashed separately and based on preceding values

The first value is computed as okm_0 = KDF(f || value) where f is a byte slice of 32 0xFF salt is zero-filled byte slice with length equal to the hash output length info is the protocol name okm is the 32 byte output

The each subsequent iteration is computed by as okm_i = KDF(f_i || value || okm_{i-1}) where f_i = 2^b - 1 - i such that there are 0xFF bytes prior to the value. f_1 changes the first byte to 0xFE, f_2 to 0xFD. The previous okm is appended to the value to provide cryptographic domain separation. See https://signal.org/docs/specifications/x3dh/#cryptographic-notation and https://signal.org/docs/specifications/xeddsa/#hash-functions for more details. This uses the KDF function similar to X3DH for each `value` But changes the key just like XEdDSA where the prefix bytes change by a single bit

func ReverseScalarBytes

func ReverseScalarBytes(inBytes []byte) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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