Sounds fine by me. Encryption program XYZ should be complimented with the encryption function xyz that does padding and encryption in one call. string aes(string key, string data)
/ Martin Nilsson (har bott i google)
Previous text:
2003-03-11 23:17: Subject: nettle-1.7
The interface I imagine is something like
Crypto.AES()->set_encrypt_key(the_key)->crypt(data)
The basic AES object will only encrypt complete blocks. Then you can wrap CBC on top of that, but that would still probably handle complete blocks.
In order to handle arbitrary length input, one must use some padding convention. An object implementing padding could also do buffering. I'm not sure I see the point of feed/drain, the most natural interface to me would be
o->crypt(data) // encrypts or buffers more data. Returns as much // output as is available
o->finish() // Do final padding, return final output.
One could do feed/drain on top of that, but perhaps that's best done in pike rather than C.
For hash functions, the interface would be close to nettles,
o = Crypto.MD5(); o->update("foo"); // Returns self, so that o->update("bar"); // Crypto.MD5()->update("foo)->digest() works too. o->digest(); // Returns digest string
So, that's basically what I've been imagining, but I'm open to suggestions.
/ Niels Möller ()