Browse Source

Merge commit '57e4074' into bfgminer

Luke Dashjr 11 years ago
parent
commit
65cd3d91c9
1 changed files with 3 additions and 2 deletions
  1. 3 2
      scrypt.c

+ 3 - 2
scrypt.c

@@ -93,7 +93,7 @@ SHA256_Transform(uint32_t * state, const uint32_t block[16], int swap)
 	/* 1. Prepare message schedule W. */
 	/* 1. Prepare message schedule W. */
 	if(swap)
 	if(swap)
 		for (i = 0; i < 16; i++)
 		for (i = 0; i < 16; i++)
-			W[i] = htobe32(block[i]);
+			W[i] = swab32(block[i]);
 	else
 	else
 		memcpy(W, block, 64);
 		memcpy(W, block, 64);
 	for (i = 16; i < 64; i += 2) {
 	for (i = 16; i < 64; i += 2) {
@@ -235,6 +235,7 @@ PBKDF2_SHA256_80_128(const uint32_t * passwd, uint32_t * buf)
 	memcpy(PShoctx.buf+8, outerpad, 32);
 	memcpy(PShoctx.buf+8, outerpad, 32);
 
 
 	/* Iterate through the blocks. */
 	/* Iterate through the blocks. */
+	swap32tole(PShictx.buf, PShictx.buf, 0x10);
 	for (i = 0; i < 4; i++) {
 	for (i = 0; i < 4; i++) {
 		uint32_t istate[8];
 		uint32_t istate[8];
 		uint32_t ostate[8];
 		uint32_t ostate[8];
@@ -246,7 +247,7 @@ PBKDF2_SHA256_80_128(const uint32_t * passwd, uint32_t * buf)
 
 
 		memcpy(ostate, PShoctx.state, 32);
 		memcpy(ostate, PShoctx.state, 32);
 		SHA256_Transform(ostate, PShoctx.buf, 0);
 		SHA256_Transform(ostate, PShoctx.buf, 0);
-		be32enc_vect(buf+i*8, ostate, 8);
+		swap32yes(buf+i*8, ostate, 8);
 	}
 	}
 }
 }