From 3c5c3280ff9712ca25b243d8c84a4f849fe164d8 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sun, 20 Oct 2013 11:04:58 -0400 Subject: Fix an endian-non-neutrality bug in new hashcash identity algo. --- node/Identity.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'node') diff --git a/node/Identity.cpp b/node/Identity.cpp index d50c56fe..0c7c13df 100644 --- a/node/Identity.cpp +++ b/node/Identity.cpp @@ -66,12 +66,13 @@ static inline void _computeMemoryHardHash(const void *publicKey,unsigned int pub // Do something to genmem[] that iteratively makes every value // possibly dependent on every other value with a nontrivial - // probability. + // probability. Continue to use already-initialized Salsa20 as + // a random source. for(unsigned int i=0;i>=8) ++((unsigned char *)genmem)[(uintptr_t)x % ZT_IDENTITY_GEN_MEMORY]; } else { @@ -135,7 +136,7 @@ bool Identity::locallyValidate() const unsigned char addrb[5]; _address.copyTo(addrb,5); - + return ( (digest[0] < ZT_IDENTITY_GEN_HASHCASH_FIRST_BYTE_LESS_THAN)&& (digest[59] == addrb[0])&& -- cgit v1.2.3