From d0f0b5ef30826556d94af7538a710add604ffc35 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Mon, 5 Nov 2012 22:47:43 +0100 Subject: [PATCH] clean stuff up --- include/codecrypt.h | 4 ++-- src/main.cpp | 53 +++------------------------------------------ 2 files changed, 5 insertions(+), 52 deletions(-) diff --git a/include/codecrypt.h b/include/codecrypt.h index 48b3494..0f78eb5 100644 --- a/include/codecrypt.h +++ b/include/codecrypt.h @@ -50,7 +50,7 @@ typedef unsigned int uint; * specialization for space efficiency. * * TODO. This is great, but some operations (ESPECIALLY add()) could be done - * blockwise for speed. Investigate/implement that. + * blockwise for O(cpu_word_size) speedup. Investigate/implement that. haha. */ class polynomial; class gf2m; @@ -80,7 +80,7 @@ public: /* * pseudorandom number generator. Meant to be inherited and - * instantiated by the user + * instantiated by the library user */ class prng { diff --git a/src/main.cpp b/src/main.cpp index 09bd3a1..d7b0224 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,6 +38,7 @@ public: int main() { + /* this is just a test, don't mind it */ primitiverng r; r.seed (0); @@ -53,8 +54,8 @@ int main() ccr::bvector plain; plain.resize (pub.plain_size(), 0); plain[0] = 1; - //plain[1] = 1; - //plain[2] = 1; + plain[1] = 1; + plain[2] = 1; cout << "PLAINTEXT" << endl; cout << plain; @@ -74,51 +75,3 @@ int main() return 0; } -#if 0 -cout << "PUBLIC KEY" << endl; -cout << pub.t << endl; -cout << pub.G; - -/* mce encryption test */ -ccr::bvector plain; -plain.resize (pub.plain_size(), 0); -plain[0] = 1; -plain[1] = 1; -plain[2] = 1; - -cout << "PLAINTEXT" << endl; -cout << plain; - -ccr::bvector cipher; -//pub.encrypt (plain, cipher, r); -pub.encrypt (plain, cipher, r, 10); - -cout << "CIPHERTEXT" << endl; -cout << cipher; - - -ccr::bvector result; -priv.decrypt (cipher, result); - -cout << "DECRYPTED" << endl; -cout << result; - -/* signature test */ - -ccr::bvector hash, signature; - -hash.resize (priv.hash_size(), 0); -hash[0] = 1; -hash[1] = 1; -hash[2] = 1; - -cout << "SIGNING" << endl << hash; -priv.sign (hash, signature, 2, priv.hash_size() *priv.hash_size(), r); -cout << "SIGNATURE" << endl << signature; -if (pub.verify (signature, hash, 2) ) - cout << "VERIFY FAIL" << endl; -else cout << "VERIFY OK" << endl; -return 0; -} - -#endif