Ben Laurie blathering

Perhaps Not So Stupid, After All?

Stupid now generates correct (single-block, still) SHA-256 code in C. It has functions. We’re starting to wonder about adding structures, and the semantics of arrays – particularly whether an array passed for output can also be used for input (or vice versa). I’m inclining towards making that illegal – if you want a function that, say, fills in every second entry in an array, then you’d need to pass in the array to be filled in, and return a second array which would be the result. The function would have to copy the input array to the output before filling in the new values (or copy the parts it isn’t going to fill in). It seems to me this makes analysis simpler, but can easily be optimised by smart compilers, too.

I guess its time we started writing some of this down! I’d also like to add generators for some common scripting languages, like Perl, Python and PHP.

The thing I’m a little scared of is that eventually, if I’m going to take this seriously, we’re going to need a bignum implementation – not too hard to do if you don’t care about efficiency, I guess.


  1. Hi Ben,

    Wondering how Stupid compares to Cryptol?


    Comment by Adam — 7 Feb 2010 @ 21:15

  2. Cryptol: Not open source.

    Stupid: open source.

    I’m sorry if I’m going to come across as a wanker in some people’s minds, but … crypto is not an area we should be competing in. We have a fundamental need for this to be done well. Cryptol may be fantastic – but it is not freely available. That kills it for this purpose, as far as I am concerned, and comparing technical merits is only donating my time to the inappropriately commercial side of crypto.

    Make Cryptol open and I will happily discuss its merits (and probably abandon Stupid).

    Comment by Ben — 7 Feb 2010 @ 21:46

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress