[Cryptography] Apollo Guidance Computer as Bitcoin mining rig
D. Hugh Redelmeier
hugh at mimosa.com
Tue Jul 16 17:27:18 EDT 2019
| From: Henry Baker <hbaker1 at pipeline.com>
| Bitcoin mining on a vintage Xerox Alto: very slow at 1.5 hashes/second
| I've been restoring a Xerox Alto minicomputer from the 1970s and
| figured it would be interesting to see if it could mine bitcoins. I
| coded up the necessary hash algorithm in BCPL (the old programming
| language used by the Alto) and found that although the mining
| algorithm ran, the Alto was so slow that it would take many times the
| lifetime of the universe to successfully mine bitcoins.
Not totally fair. If you were really trying to mine on the Altair,
you'd microcode it. The article mentions this. That would likely
make it at least 10 times faster (pure guess).
- 400000 instructions/second for compiled BCPL vs
6000000 microcode instructions/second
- "the SHA-256 algorithm makes heavy use of Boolean operations
including exclusive-OR and OR. These are pretty basic instructions
that you'd find on even something as primitive as the 6502, but the
Alto doesn't have them"
I'm pretty sure that the microcode does have these operations
because the ALU is a naked sn74181 and that has such functions.
- "SHA-256 heavily uses bit shift and rotate operations.
Modern processors typically have a "barrel shifter" that lets you
shift by as many bits as you want in one step. The Alto's shift
instructions, on the other hand, only shift a single bit. Thus, to
shift by, say 10 bits, the Alto code calls a subroutine that performs
10 separate shift instructions."
The microcode does only have a one-bit shifter but it can also
rotate by 8 bits (a byte swap, I guess). To efficiently shift
by 8 bits, one could exploit this feature.
Also, since the words are 16 bits, shifting a larger entity by 16
bits can be probably be accomplished by shuffling the words. One
could thus implement a shift by 10 as a shuffle and a shift by 6 (10
= 16 - 6).
- the microcode seems to have an RSEL (register select field) of 5
bits so it likely has 32 registers (of 16 bits). If that is enough
to calculate a hash, the speedup would be considerable.
More information about the cryptography