1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-25 08:51:26 +00:00

PrintSizes

This commit is contained in:
Henry Case 2021-12-17 16:10:15 +00:00
parent 649f32d1f4
commit 8ef29b532e

View File

@ -1,4 +1,5 @@
#include <algorithm> #include <algorithm>
#include <sstream>
#include <vector> #include <vector>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <pqc/pqc.h> #include <pqc/pqc.h>
@ -50,3 +51,25 @@ TEST(SIGN,OneOff) {
pqc_sig_verify(p, sig.data(), sigsz, msg, 1234, pk.data())); pqc_sig_verify(p, sig.data(), sigsz, msg, 1234, pk.data()));
} }
} }
TEST(KEMSIG,PrintSizes) {
for (int i=0; i<PQC_ALG_SIG_MAX; i++) {
std::stringstream out;
const pqc_ctx_t *p = pqc_sig_alg_by_id(i);
out << std::setw(30) << std::left << p->alg_name
<< " :pk: " << std::setw(15) << pqc_public_key_bsz(p)
<< " :sign: " << std::setw(15) << pqc_signature_bsz(p);
std::cout << out.str() << std::endl;
}
for (int i=0; i<PQC_ALG_KEM_MAX; i++) {
std::stringstream out;
const pqc_ctx_t *p = pqc_kem_alg_by_id(i);
out << std::setw(30) << std::left << p->alg_name
<< " :pk: " << std::setw(15) << pqc_public_key_bsz(p)
<< " :ct: " << std::setw(15) << pqc_ciphertext_bsz(p);
std::cout << out.str() << std::endl;
}
}