/* digest up to msglen bytes of input (full blocks only) */ static void Transform(hashState *ctx, const uint8_t *input, int msglen) { /* digest message, one block at a time */ for (; msglen >= SIZE512; msglen -= SIZE512, input += SIZE512) { F512(ctx->chaining,(uint32_t*)input); /* increment block counter */ ctx->block_counter1++; if (ctx->block_counter1 == 0) ctx->block_counter2++; } }
/* digest up to msglen bytes of input (full blocks only) */ void Transform(hashState *ctx, const u8 *input, int msglen) { //ADDED BY GURPREET ctx->cnt_buf_ptr = ctx->statesize; /*for block counter*/ while (ctx->cnt_buf_ptr > 0) { ctx->counter[--ctx->cnt_buf_ptr] = (u8)ctx->cnt_block; ctx->cnt_block >>= 8; } ctx->cnt_buf_ptr = ctx->statesize; //------- /* determine variant, SHORT or LONG, and select underlying compression function based on the variant */ if (ctx->size == SHORT) { /* increment block counter */ //ctx->block_counter += msglen/SIZE1024; //modified while (msglen >= SIZE1024) { F512(ctx->chaining,(u64*)input, (u64*)ctx->counter); //modified //ADDSED bY GURPREET-- Feb14,2012 ctx->block_counter++; //---------- //if (ctx->block_counter1 == 0) ctx->block_counter2++; //ADDED BY GURPREET //reset to last position ctx->cnt_buf_ptr = ctx->statesize; //set to same as block counter ctx->cnt_block=ctx->block_counter+1; /*for counter*/ while (ctx->cnt_buf_ptr > 0) { ctx->counter[--ctx->cnt_buf_ptr] = (u8)ctx->cnt_block; ctx->cnt_block >>= 8; } //---- msglen -= SIZE1024; input += SIZE1024; } } /* else { // increment block counter ctx->block_counter += msglen/SIZE1024; while (msglen >= SIZE1024) { F1024(ctx->chaining,(u64*)input); msglen -= SIZE1024; input += SIZE1024; } }*/ }