packages feed

cryptohash 0.8.3 → 0.8.4

raw patch · 4 files changed

+12/−7 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

cbits/sha3.c view
@@ -56,7 +56,7 @@  	/* merge buf with state */ 	for (i = 0; i < bufsz; i++)-		state[i] ^= buf[i];+		state[i] ^= le64_to_cpu(buf[i]);  	/* run keccak rounds */ 	for (r = 0; r < KECCAK_NB_ROUNDS; r++) {@@ -137,6 +137,8 @@  void sha3_finalize(struct sha3_ctx *ctx, uint8_t *out) {+	uint64_t w[25];+ 	/* add the 10*1 padding */ 	ctx->buf[ctx->bufindex++] = 1; 	memset(ctx->buf + ctx->bufindex, 0, ctx->bufsz - ctx->bufindex);@@ -146,5 +148,6 @@ 	sha3_do_chunk(ctx->state, (uint64_t *) ctx->buf, ctx->bufsz / 8);  	/* output */-	memcpy(out, ctx->state, ctx->hashlen);+	cpu_to_le64_array(w, ctx->state, 25);+	memcpy(out, w, ctx->hashlen); }
cbits/skein256.c view
@@ -174,6 +174,7 @@ 		x[j] = ctx->h[j]; 	/* threefish in counter mode, 0 for 1st 64 bytes, 1 for 2nd 64 bytes, .. */ 	for (i = 0; i*32 < outsize; i++) {+		uint64_t w[4]; 		*((uint64_t *) ctx->buf) = cpu_to_le64(i); 		SET_TYPE(ctx, FLAG_FIRST | FLAG_FINAL | FLAG_TYPE(TYPE_OUT)); 		skein256_do_chunk(ctx, (uint64_t *) ctx->buf, sizeof(uint64_t));@@ -181,8 +182,8 @@ 		n = outsize - i * 32; 		if (n >= 32) n = 32; -		/* FIXME should be little endian array copy ? */-		memcpy(out + i*32, ctx->h, n);+		cpu_to_le64_array(w, ctx->h, 4);+		memcpy(out + i*32, w, n);  		/* restore h[0--4] */ 		for (j = 0; j < 4; j++)
cbits/skein512.c view
@@ -192,6 +192,7 @@ 		x[j] = ctx->h[j]; 	/* threefish in counter mode, 0 for 1st 64 bytes, 1 for 2nd 64 bytes, .. */ 	for (i = 0; i*64 < outsize; i++) {+		uint64_t w[8]; 		*((uint64_t *) ctx->buf) = cpu_to_le64(i); 		SET_TYPE(ctx, FLAG_FIRST | FLAG_FINAL | FLAG_TYPE(TYPE_OUT)); 		skein512_do_chunk(ctx, (uint64_t *) ctx->buf, sizeof(uint64_t));@@ -199,8 +200,8 @@ 		n = outsize - i * 64; 		if (n >= 64) n = 64; -		/* FIXME should be little endian array copy ? */-		memcpy(out + i*64, ctx->h, n);+		cpu_to_le64_array(w, ctx->h, 8);+		memcpy(out + i*64, w, n);  		/* restore h[0--7] */ 		for (j = 0; j < 8; j++)
cryptohash.cabal view
@@ -1,5 +1,5 @@ Name:                cryptohash-Version:             0.8.3+Version:             0.8.4 Description:     A collection of crypto hashes, with a practical incremental and one-pass, pure APIs,     with performance close to the fastest implementations available in others languages.