frodo640shake

package
v0.0.0-...-7833c67 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package frodo640shake implements the variant FrodoKEM-640 with SHAKE.

Index

Constants

View Source
const (
	// Size of seed for NewKeyFromSeed.
	// = len(s) + len(seedSE) + len(z).
	KeySeedSize = SharedKeySize + SharedKeySize + 16

	// Size of seed for EncapsulateTo.
	EncapsulationSeedSize = 16

	// Size of the established shared key.
	SharedKeySize = 16

	// Size of the encapsulated shared key.
	CiphertextSize = 9720

	// Size of a packed public key.
	PublicKeySize = 9616

	// Size of a packed private key.
	PrivateKeySize = 19888
)

Variables

This section is empty.

Functions

func Scheme

func Scheme() kem.Scheme

Scheme returns a KEM interface.

Types

type PrivateKey

type PrivateKey struct {
	// contains filtered or unexported fields
}

Type of a FrodoKEM-640-SHAKE private key

func (*PrivateKey) DecapsulateTo

func (sk *PrivateKey) DecapsulateTo(ss, ct []byte)

DecapsulateTo computes the shared key that is encapsulated in ct from the private key.

Panics if ct or ss are not of length CiphertextSize and SharedKeySize respectively.

func (*PrivateKey) Equal

func (sk *PrivateKey) Equal(other kem.PrivateKey) bool

func (*PrivateKey) MarshalBinary

func (sk *PrivateKey) MarshalBinary() ([]byte, error)

func (*PrivateKey) Pack

func (sk *PrivateKey) Pack(buf []byte)

Packs sk to buf.

Panics if buf is not of size PrivateKeySize.

func (*PrivateKey) Public

func (sk *PrivateKey) Public() kem.PublicKey

func (*PrivateKey) Scheme

func (sk *PrivateKey) Scheme() kem.Scheme

func (*PrivateKey) Unpack

func (sk *PrivateKey) Unpack(buf []byte)

Unpacks sk from buf.

Panics if buf is not of size PrivateKeySize.

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

Type of a FrodoKEM-640-SHAKE public key

func (*PublicKey) EncapsulateTo

func (pk *PublicKey) EncapsulateTo(ct []byte, ss []byte, seed []byte)

EncapsulateTo generates a shared key and a ciphertext containing said key from the public key and the randomness from seed and writes the shared key to ss and ciphertext to ct.

Panics if ss, ct, or seed are not of length SharedKeySize, CiphertextSize and EncapsulationSeedSize respectively.

seed may be nil, in which case crypto/rand.Reader is used to generate one.

func (*PublicKey) Equal

func (pk *PublicKey) Equal(other kem.PublicKey) bool

func (*PublicKey) MarshalBinary

func (pk *PublicKey) MarshalBinary() ([]byte, error)

func (*PublicKey) Pack

func (pk *PublicKey) Pack(buf []byte)

Packs pk to buf.

Panics if buf is not of size PublicKeySize.

func (*PublicKey) Scheme

func (pk *PublicKey) Scheme() kem.Scheme

func (*PublicKey) Unpack

func (pk *PublicKey) Unpack(buf []byte)

TODO: Unpacks pk from buf.

Panics if buf is not of size PublicKeySize.

Jump to

Keyboard shortcuts

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