Geek: what takes 80 seconds to do a double SHA-256 hash? An IBM 1401 mainframe computer, that's what. The bad performance isn't just because of slow clock speed – it's also down to the fact that the 1401 doesn't have a conventional binary ALU; instead it uses BCD math. The logical operations in the SHA-256 algorithm are relatively easy with a binary ALU; they are horribly difficult using BCD.
Even on the old computers I first learned to program on, I never had that particular problem – they all had binary ALUs, though they didn't use two's-complement math (they used one's-complement math because back then it was slightly faster). I did, however, once have almost the inverse of this challenge: I implemented a BCD-based floating point package (complete with logarithms and trig functions) that ran on an Intel 8080 microprocessor. This was made slightly more bearable by the built-in support for adding two BCD digits packed into a byte – but still, multiplication and division were quite painful. And painfully slow...
No comments:
Post a Comment