Index  Comments

Continuing from my SHA1 implementation, this is the beginning of a planned comprehensive SHA library I've been designing. The intent is still to have a package in which every symbol is referenced with its package prefix, but the modifications to the basic design of that SHA1 in becoming comprehensive have made this slightly less appealing. The line count is nearing three hundred. As with the SHA1, the octet is the basic unit. I've allowed this Common Lisp to further diverge from the other two by defining a nice overarching CLOS protocol. I've made some nice improvements since the SHA1; no code is shared.

This program is licensed under the GNU Affero General Public License version three.

It's no nice, to get some of the name overloading of Ada with CLOS, and it allows me to reuse a good deal of code, as well. The basic idea of the CLOS protocol is to have a single STATUS class and the specific SHA deriving thereof. I've nicely made use of the different class and value namespaces, in that SHA:224 and SHA:256 are the STATUS classes and also constants of the initial values. Differing from the SHA1 is the hashing function name, now BLOCKHASH; there's a BLOCKLENGTH generic function in preparation for varying block lengths. In this implementation, the PAD isn't generic, but this will change. There's also a DIGEST function for when hashing is finished, and I'm quite pleased with its implementation. The primary downside to this approach is that SHA:HASH has two required parameters, that extra being the STATUS, even though it's only to be used for dispatching internally. My naming scheme certainly makes it better, though. A consequence being one can manually prefix that SHA:HASH before it controls and terminates the function.

I'll bother documenting it more comprehensively and updating later; there are documentation strings.

Here is the source. Here is the license.