encoding

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package encoding provides encoding utilities.

Package encoding provides encoding utilities.

Index

Constants

This section is empty.

Variables

View Source
var PointLength = map[group.Group]int{
	group.Ristretto255Sha512: ristrettoPointLength,

	group.P256Sha256:       p256PointLength,
	group.P384Sha512:       p384PointLength,
	group.P521Sha512:       p521PointLength,
	group.Curve25519Sha512: curve25519PointLength,
}

PointLength indexes the length of elements.

View Source
var ScalarLength = map[group.Group]int{
	group.Ristretto255Sha512: ristrettoScalarLength,

	group.P256Sha256:       p256ScalarLength,
	group.P384Sha512:       p384ScalarLength,
	group.P521Sha512:       p521ScalarLength,
	group.Curve25519Sha512: curve25519ScalarLength,
}

ScalarLength indexes the length of scalars.

Functions

func Concat

func Concat(a, b []byte) []byte

Concat returns the concatenation of the two input byte strings.

func Concat3

func Concat3(a, b, c []byte) []byte

Concat3 returns the concatenation of the three input byte strings.

func Concatenate

func Concatenate(input ...[]byte) []byte

Concatenate takes the variadic array of input and returns a concatenation of it.

func DecodeVector

func DecodeVector(in []byte) (data []byte, offset int, err error)

DecodeVector returns the byte-slice of length indexed in the first two bytes.

func EncodeVector

func EncodeVector(input []byte) []byte

EncodeVector returns the input with a two-byte encoding of its length.

func EncodeVectorLen

func EncodeVectorLen(input []byte, length int) []byte

EncodeVectorLen returns the input prepended with a byte encoding of its length.

func I2OSP

func I2OSP(value, length int) []byte

I2OSP 32 bit Integer to Octet Stream Primitive on maximum 4 bytes.

func OS2IP

func OS2IP(input []byte) int

OS2IP Octet Stream to Integer Primitive on maximum 4 bytes / 32 bits.

func PadPoint

func PadPoint(point []byte, c group.Group) []byte

PadPoint pads the encoded element if necessary.

func SerializePoint

func SerializePoint(e *group.Point, c group.Group) []byte

SerializePoint pads the given element if necessary.

func SerializeScalar

func SerializeScalar(s *group.Scalar, c group.Group) []byte

SerializeScalar pads the given scalar if necessary.

func SuffixString

func SuffixString(a []byte, b string) []byte

SuffixString returns the concatenation of the input byte string and the string argument.

Types

This section is empty.

Jump to

Keyboard shortcuts

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