kyber768

package
v0.0.0-...-78380f7 Latest Latest
Warning

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

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

Documentation

Overview

kyber768 implements the IND-CPA-secure Public Key Encryption scheme Kyber768.CPAPKE as submitted to round 3 of the NIST PQC competition and described in

https://pq-crystals.org/kyber/data/kyber-specification-round3.pdf

Index

Constants

View Source
const (
	// Size of seed for NewKeyFromSeed
	KeySeedSize = internal.SeedSize

	// Size of seed for EncryptTo
	EncryptionSeedSize = internal.SeedSize

	// Size of a packed PublicKey
	PublicKeySize = internal.PublicKeySize

	// Size of a packed PrivateKey
	PrivateKeySize = internal.PrivateKeySize

	// Size of a ciphertext
	CiphertextSize = internal.CiphertextSize

	// Size of a plaintext
	PlaintextSize = internal.PlaintextSize
)

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(rand io.Reader) (*PublicKey, *PrivateKey, error)

GenerateKey generates a public/private key pair using entropy from rand. If rand is nil, crypto/rand.Reader will be used.

func NewKeyFromSeed

func NewKeyFromSeed(seed []byte) (*PublicKey, *PrivateKey)

NewKeyFromSeed derives a public/private key pair using the given seed.

Panics if seed is not of length KeySeedSize.

Types

type PrivateKey

type PrivateKey internal.PrivateKey

PrivateKey is the type of Kyber768.CPAPKE private key

func (*PrivateKey) DecryptTo

func (sk *PrivateKey) DecryptTo(pt []byte, ct []byte)

DecryptTo decrypts message ct for the private key and writes the plaintext to pt.

This function panics if the lengths of ct and pt are not CiphertextSize and PlaintextSize respectively.

func (*PrivateKey) Equal

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

Returns whether the two private keys are equal.

func (*PrivateKey) Pack

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

Packs sk into the given buffer.

Panics if buf is not of length PrivateKeySize.

func (*PrivateKey) Unpack

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

Unpacks sk from the given buffer.

Panics if buf is not of length PrivateKeySize.

type PublicKey

type PublicKey internal.PublicKey

PublicKey is the type of Kyber768.CPAPKE public key

func (*PublicKey) EncryptTo

func (pk *PublicKey) EncryptTo(ct []byte, pt []byte, seed []byte)

EncryptTo encrypts message pt for the public key and writes the ciphertext to ct using randomness from seed.

This function panics if the lengths of pt, seed, and ct are not PlaintextSize, EncryptionSeedSize, and CiphertextSize respectively.

func (*PublicKey) Pack

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

Packs pk into the given buffer.

Panics if buf is not of length PublicKeySize.

func (*PublicKey) Unpack

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

Unpacks pk from the given buffer.

Panics if buf is not of length PublicKeySize.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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