
Here's a response to a question asked on the private review system: The design and architecture is based on dynamic polymorphism, for better or worse. In the process of porting it to Boost.Botan, it would be made static. On the mailing list, someone created a simple project that creates a certificate and the exe grew from 40kb to 1mb. Having static polymorphism would solve this problem. Also, we won't have to pay the runtime penalties for dp (especially since it's not needed - something that Boost libraries have shown time and time again). Looking at other libraries under similar licenses yielded similar results. Crypto++ also uses DP (and has even larger hierarchies) and for simple uses, the entire library get's built and included with project. For example, http://www.cryptopp.com/docs/ref/class_s_h_a1.html. SP will solve this problem, and Botan uses less DP which should make it easier to convert. I couldn't find a valid libtomcrypt homepage, so I don't know how it's structured. The interface of Botan is simple and intuitive. Looking at their sample programs (and other samples), there doesn't seem to be a simpler method to implement the various techniques and still remain flexible. Crypto++ samples seem to be a bit difficult to digest, requiring manual creation of secure memory blocks and ugly dynamic casting. More can be seen here: http://www.cryptopp.com/wiki/Diffie-Hellman. All in all, Botan has a simpler interface and a DP hierarchy that shouldn't be (as) difficult to convert to SP. I wanted to compare against libtomcrypt, but couldn't find a valid implementation. An example of how something might get ported would be the following. Botan.AES_128 has the inheritance hierarchy Botan->SymmetricAlgorithm->BlockCipher->AES->AES_128. Writing this as SP would look like the following (if I understand SP correctly): Before: class SymmetricAlgorithm { void set_key(...) } class BlockCipher: SymmetricAlgorithm { virtual void encrypt(...) virtual void decrypt(...) } class AES: BlockCipher { void encrypt(...); void decrypt(...); } class AES_128: AES { } There is no reason for AES. I'd first remove that class and have AES_128 derive from BlockCipher directly. Converting this to SP yields (sorry, I don't have a compiler to test this atm): template<class BlockCipher> struct SymmetricAlgorithm { void set_key_impl() { static_cast<*BlockCipher>(this)->set_key(); } } template <class AES_128> struct BlockCipher: SymmetricAlgorithm<BlockCipher>{ void set_key(); //More stuff } However, there is one concern. SymmetricAlgorithm is the base class of three major hierarchies: BlockCipher, MessageAuthenticationCode, and StreamCipher. If this inheritance hierarchy stays, it will mean lot's of template metaprogramming (some of which I don't know how to do). In any case, it's easier to work with than Crypto++. For example, SHA1 in Crypto++ has a hierarchy depth of 9; Botan 5. Hope this answers some questions! Glad you are interested in my work! Chad Seibert _________________________________________________________________ The New Busy is not the old busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:W...

On 14 April 2010 12:44, Chad Seibert <chadseibert@live.com> wrote:
Writing this as SP would look like the following (if I understand SP correctly):
For static polymorphism, you write to provide the interface demanded by the concept; you don't need to derive from anything. Consider the Boost.Random concepts, for instance <http://www.boost.org/doc/libs/1_42_0/libs/random/random-concepts.html>. boost::mt19937 isn't derived from some UniformRandomGenerator class. It just provides the necessarily facilities. In my experiments with hash functions, the nicest parts of generic programming has come from the various constructions used to build algorithms out of primitives. For example, I can write a SHA-512 block hash as merkle_damgard_block_hash< sha2_policy<512>::initialization_vector_generator, davies_meyer_compressor<shacal2_block_cypher<512>, state_adder>, digest_from_state<digest<512>, display_endian::big_word_big_byte> > By building it out of the SHACAL-2 block cypher <http://en.wikipedia.org/wiki/SHACAL> run through the Davies-Meyer construction to produce a One-way Compression Function <http://en.wikipedia.org/wiki/One-way_compression_function#Davies-Meyer> which is used repeatedly in the Merkle–Damgård construction to create the hash function <http://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction>. There's no BlockCypher class, no OneWayCompressor class, etc. They're just concepts.

On 4/14/2010 1:02 PM, Scott McMurray wrote:
There's no BlockCypher class, no OneWayCompressor class, etc. They're just concepts.
That's a really good point. Perhaps step 1 should be defining concepts. Then the models can duke it out for king of the crypto hill. That would be awesome!

"Chad Seibert" <chadseibert@live.com> wrote in message news:BAY113-W12733E3A72DE7C713A8D1AD3100@phx.gbl...
I wanted to compare against libtomcrypt, but couldn't find a valid implementation.
I provided links in this post: http://permalink.gmane.org/gmane.comp.lib.boost.devel/202443 There you can also find a link that compares it with many other crypto libraries... As already said it is unfortunately no longer maintained so it is mostly available only from Linux distribution mirrors...but, since it is left in the public domain, this can also be an opportunity to boostify it (if the Botan 'deal' 'fails') continue where it left off... ps. You should probably also coordinate with the authors of the 'big int' libraries being proposed as such a library is 'central' to any crypto library... -- "What Huxley teaches is that in the age of advanced technology, spiritual devastation is more likely to come from an enemy with a smiling face than from one whose countenance exudes suspicion and hate." Neil Postman
participants (4)
-
Chad Seibert
-
Domagoj Saric
-
Scott McMurray
-
Sohail Somani