Documentation ¶
Overview ¶
Package kyberk2so provides a clean implementation of the Kyber IND-CCA2-secure key encapsulation mechanism (KEM), whose security is based on the hardness of solving the learning-with-errors (LWE) problem over module lattices.
Index ¶
- Constants
- func KemDecrypt1024(ciphertext [Kyber1024CTBytes]byte, privateKey [Kyber1024SKBytes]byte) ([KyberSSBytes]byte, error)
- func KemDecrypt512(ciphertext [Kyber512CTBytes]byte, privateKey [Kyber512SKBytes]byte) ([KyberSSBytes]byte, error)
- func KemDecrypt768(ciphertext [Kyber768CTBytes]byte, privateKey [Kyber768SKBytes]byte) ([KyberSSBytes]byte, error)
- func KemEncrypt1024(publicKey [Kyber1024PKBytes]byte) ([Kyber1024CTBytes]byte, [KyberSSBytes]byte, error)
- func KemEncrypt512(publicKey [Kyber512PKBytes]byte) ([Kyber512CTBytes]byte, [KyberSSBytes]byte, error)
- func KemEncrypt768(publicKey [Kyber768PKBytes]byte) ([Kyber768CTBytes]byte, [KyberSSBytes]byte, error)
- func KemKeypair1024() ([Kyber1024SKBytes]byte, [Kyber1024PKBytes]byte, error)
- func KemKeypair512() ([Kyber512SKBytes]byte, [Kyber512PKBytes]byte, error)
- func KemKeypair768() ([Kyber768SKBytes]byte, [Kyber768PKBytes]byte, error)
Constants ¶
const Kyber1024CTBytes int = paramsPolyvecCompressedBytesK1024 + paramsPolyCompressedBytesK1024
Kyber1024CTBytes is a constant representing the byte length of ciphertexts in Kyber-1024.
const Kyber1024PKBytes int = paramsPolyvecBytesK1024 + paramsSymBytes
Kyber1024PKBytes is a constant representing the byte length of public keys in Kyber-1024.
const Kyber1024SKBytes int = paramsPolyvecBytesK1024 + ((paramsPolyvecBytesK1024 + paramsSymBytes) + 2*paramsSymBytes)
Kyber1024SKBytes is a constant representing the byte length of private keys in Kyber-1024.
const Kyber512CTBytes int = paramsPolyvecCompressedBytesK512 + paramsPolyCompressedBytesK512
Kyber512CTBytes is a constant representing the byte length of ciphertexts in Kyber-512.
const Kyber512PKBytes int = paramsPolyvecBytesK512 + paramsSymBytes
Kyber512PKBytes is a constant representing the byte length of public keys in Kyber-512.
const Kyber512SKBytes int = paramsPolyvecBytesK512 + ((paramsPolyvecBytesK512 + paramsSymBytes) + 2*paramsSymBytes)
Kyber512SKBytes is a constant representing the byte length of private keys in Kyber-512.
const Kyber768CTBytes int = paramsPolyvecCompressedBytesK768 + paramsPolyCompressedBytesK768
Kyber768CTBytes is a constant representing the byte length of ciphertexts in Kyber-768.
const Kyber768PKBytes int = paramsPolyvecBytesK768 + paramsSymBytes
Kyber768PKBytes is a constant representing the byte length of public keys in Kyber-768.
const Kyber768SKBytes int = paramsPolyvecBytesK768 + ((paramsPolyvecBytesK768 + paramsSymBytes) + 2*paramsSymBytes)
Kyber768SKBytes is a constant representing the byte length of private keys in Kyber-768.
const KyberSSBytes int = 32
KyberSSBytes is a constant representing the byte length of shared secrets in Kyber.
Variables ¶
This section is empty.
Functions ¶
func KemDecrypt1024 ¶ added in v0.0.4
func KemDecrypt1024( ciphertext [Kyber1024CTBytes]byte, privateKey [Kyber1024SKBytes]byte, ) ([KyberSSBytes]byte, error)
KemDecrypt1024 takes a ciphertext (from KeyEncrypt1024), a private key (from KemKeypair1024) and returns a 32-byte shared secret. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemDecrypt512 ¶ added in v0.0.4
func KemDecrypt512( ciphertext [Kyber512CTBytes]byte, privateKey [Kyber512SKBytes]byte, ) ([KyberSSBytes]byte, error)
KemDecrypt512 takes a ciphertext (from KeyEncrypt512), a private key (from KemKeypair512) and returns a 32-byte shared secret. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemDecrypt768 ¶ added in v0.0.4
func KemDecrypt768( ciphertext [Kyber768CTBytes]byte, privateKey [Kyber768SKBytes]byte, ) ([KyberSSBytes]byte, error)
KemDecrypt768 takes a ciphertext (from KeyEncrypt768), a private key (from KemKeypair768) and returns a 32-byte shared secret. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemEncrypt1024 ¶ added in v0.0.4
func KemEncrypt1024(publicKey [Kyber1024PKBytes]byte) ( [Kyber1024CTBytes]byte, [KyberSSBytes]byte, error, )
KemEncrypt1024 takes a public key (from KemKeypair1024) as input and returns a ciphertext and a 32-byte shared secret. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemEncrypt512 ¶ added in v0.0.4
func KemEncrypt512(publicKey [Kyber512PKBytes]byte) ( [Kyber512CTBytes]byte, [KyberSSBytes]byte, error, )
KemEncrypt512 takes a public key (from KemKeypair512) as input and returns a ciphertext and a 32-byte shared secret. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemEncrypt768 ¶ added in v0.0.4
func KemEncrypt768(publicKey [Kyber768PKBytes]byte) ( [Kyber768CTBytes]byte, [KyberSSBytes]byte, error, )
KemEncrypt768 takes a public key (from KemKeypair768) as input and returns a ciphertext and a 32-byte shared secret. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemKeypair1024 ¶ added in v0.0.4
func KemKeypair1024() ([Kyber1024SKBytes]byte, [Kyber1024PKBytes]byte, error)
KemKeypair1024 returns a Kyber-1024 private key and a corresponding Kyber-1024 public key. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemKeypair512 ¶ added in v0.0.4
func KemKeypair512() ([Kyber512SKBytes]byte, [Kyber512PKBytes]byte, error)
KemKeypair512 returns a Kyber-512 private key and a corresponding Kyber-512 public key. An accompanying error is returned if no sufficient randomness could be obtained from the system.
func KemKeypair768 ¶ added in v0.0.4
func KemKeypair768() ([Kyber768SKBytes]byte, [Kyber768PKBytes]byte, error)
KemKeypair768 returns a Kyber-768 private key and a corresponding Kyber-768 public key. An accompanying error is returned if no sufficient randomness could be obtained from the system.
Types ¶
This section is empty.