[hashcash] Re: Problem with PowerPC Altivec engine

  • From: Jonathan Morton <chromi@xxxxxxxxxxxxxxxxxxxxx>
  • To: hashcash@xxxxxxxxxxxxx
  • Date: Mon, 31 Jan 2005 21:41:08 +0000

I'm getting occasional bad outputs on my Mac iBook when minting 29 bit
coins with a long resource name.  This is for my rpow.net project which
uses a fixed resource name of 71672bc400000017-000003c2-0001.rpow.net.

Here is a sample GOOD output:

./hashcash -m -b 29 -r 71672bc400000017-000003c2-0001.rpow.net
hashcash token: 1:29:050131:71672bc400000017-000003c2-0001.rpow.net::TP+l7rpzbtJoqygB: 000000000000000000000HJZop

Here is a sample BAD output:

./hashcash -m -b 29 -r 71672bc400000017-000003c2-0001.rpow.net
hashcash token: 1:29:050131:71672bc400000017-000zFsHIgwYn9MnogZF: 0000000000000000000000000000000000000000007/FQn

You will notice that it's not well formed, there are only 4 colons rather
than 6.

It fails about one time in 5 or so.

I'm guessing that it fails more often when higher bit counts are used - the bug appears to be in the "wraparound" code used when more than 2^31 iterations are needed to find a collision. The problem is that when wrapping, the "tail" position is not reset, but it is updated in the body of the loop.

This test was done compiling with no optimization, because I thought
the Mac's optimizer might be having problems.  The Mac gcc compiler
actually gets an internal compiler error when compiling with -O3 on
fastmint_altivec_standard_2.c, so I compile that one manually without

I've recently reported this compiler bug to Apple, so we should see that particular problem improve soonish.

from:     Jonathan "Chromatix" Morton
mail:     chromi@xxxxxxxxxxxxxxxxxxxxx
website:  http://www.chromatix.uklinux.net/
tagline:  The key to knowledge is not to rely on people to teach you it.

Other related posts: