NIST Selects HQC as Fifth Algorithm for Post-Quantum EncryptionHere are the main points from that announcement:
"Security Strength" refers to the number of bits of security, meaning that a brute force attack would need to search through that many bits to find the key.
Algorithm Claimed NIST Level Public key size (bytes) Secret key size (bytes) HQC-128 1 2249 2305 HQC-192 3 4522 4586 HQC-256 5 7245 7317
sudo apt update
sudo apt install cmake
git clone --depth=1 https://github.com/open-quantum-safe/liboqs
cmake -S liboqs -B liboqs/build -DBUILD_SHARED_LIBS=ON
cmake --build liboqs/build --parallel 8
sudo cmake --build liboqs/build --target install
python3 -m venv hqc
source hqc/bin/activate
python3 -m ensurepip --upgrade
git clone --depth=1 https://github.com/open-quantum-safe/liboqs-python
cd liboqs-python
pip install .
pip install pycryptodome
python3
import oqs
kemalg = 'HQC-128'
with oqs.KeyEncapsulation(kemalg) as client:
with oqs.KeyEncapsulation(kemalg) as server:
public_key_client = client.generate_keypair()
ciphertext, shared_secret_server = server.encap_secret(public_key_client)
shared_secret_client = client.decap_secret(ciphertext)
secret_key_client = client.export_secret_key()
print("Client Public Key: length=", len(public_key_client),
"Value:", public_key_client.hex()[:20], "...")
print("Client Secret Key: length=", len(secret_key_client),
"Value:", secret_key_client.hex()[:20], "...")
print("Client Shared Secret: length=", len(shared_secret_client),
"Value:", shared_secret_client.hex()[:20], "...")
print("Server Shared Secret: length=", len(shared_secret_server),
"Value:", shared_secret_server.hex()[:20], "...")
Notice these things:
import hashlib
from Crypto.Cipher import AES
aes_key = hashlib.pbkdf2_hmac('sha256', shared_secret_server, b"", 1024, 16)
print("AES Key: length=", len(aes_key), aes_key.hex())
You see a key that is 16 bytes long,
as shown below.
cleartext = b'Using Post-Quantum Cryptography!'
iv = b"0000111122223333"
cipher = AES.new(aes_key, AES.MODE_GCM, nonce=iv)
ciphertext = cipher.encrypt(cleartext)
print("Ciphertext: ", ciphertext.hex())
THe ciphetext is random-appearing hex bytes,
as shown below.
iv = b"0000111122223333"
cipher = AES.new(aes_key, AES.MODE_GCM, nonce=iv)
decrtext = cipher.decrypt(ciphertext)
print("Decrypted text: ", decrtext)
The cleartext message is recovered,
as shown below.
C 810.1: Server Details (10 pts)
Execute this command:The flag is covered by a green rectangle in the image below.
print(server.details)
Posted and video added 4-9-25