libmd/crypto/sha2/sha256c.c
/* Add padding and terminating bit-count. */
Add padding and terminating bit-count.
Add padding and terminating bit - count .
static void
SHA256_Pad(SHA256_CTX * ctx)
{
	size_t r;
	r = (ctx->count >> 3) & 0x3f;
	if (r < 56) {
		memcpy(&ctx->buf[r], PAD, 56 - r);
	} else {
		memcpy(&ctx->buf[r], PAD, 64 - r);
		SHA256_Transform(ctx->state, ctx->buf);
		memset(&ctx->buf[0], 0, 56);
	}
	be64enc(&ctx->buf[56], ctx->count);
	SHA256_Transform(ctx->state, ctx->buf);
}
static void SHA256_Pad ( SHA256_CTX * ctx ) { size_t r ; r = ( ctx -> count >> 3 ) & 0x3f ; if ( r < 56 ) { memcpy ( & ctx -> buf [ r ] , PAD , 56 - r ) ; } else { memcpy ( & ctx -> buf [ r ] , PAD , 64 - r ) ; SHA256_Transform ( ctx -> state , ctx -> buf ) ; memset ( & ctx -> buf [ 0 ] , 0 , 56 ) ; } be64enc ( & ctx -> buf [ 56 ] , ctx -> count ) ; SHA256_Transform ( ctx -> state , ctx -> buf ) ; }
Add padding and terminating bit-count.
Add padding and terminating bit - count .
/* Figure out how many bytes we have buffered. */ /* Pad to 56 mod 64, transforming if we finish a block en route. */ /* Pad to 56 mod 64. */ /* Finish the current block and mix. */ /* The start of the final block is all zeroes. */ /* Add the terminating bit-count. */ /* Mix in the final block. */