예제 #1
0
파일: mksum.c 프로젝트: lsylsy2/DeltaCFS
/**
 * State of trying to send the signature header.
 */
static rs_result rs_sig_s_header(rs_job_t *job)
{
    rs_squirt_n4(job, RS_SIG_MAGIC);
    rs_squirt_n4(job, job->block_len);
    rs_squirt_n4(job, job->strong_sum_len);
    rs_trace("sent header (magic %#x, block len = %d, strong sum len = %d)",
             RS_SIG_MAGIC, (int) job->block_len, (int) job->strong_sum_len);
    job->stats.block_len = job->block_len;
    
    job->statefn = rs_sig_s_generate;
    return RS_RUNNING;
}
예제 #2
0
파일: mksum.c 프로젝트: lsylsy2/DeltaCFS
/**
 * Generate the checksums for a block and write it out.  Called when
 * we already know we have enough data in memory at \p block.
 */
static rs_result
rs_sig_do_block(rs_job_t *job, const void *block, size_t len)
{
    unsigned int        weak_sum;
    rs_strong_sum_t     strong_sum;

    weak_sum = rs_calc_weak_sum(block, len);

    //rs_calc_strong_sum(block, len, &strong_sum);

    rs_squirt_n4(job, weak_sum);
    rs_tube_write(job, strong_sum, job->strong_sum_len);

	/*
    if (rs_trace_enabled()) {
        char                strong_sum_hex[RS_MD4_LENGTH * 2 + 1];
        rs_hexify(strong_sum_hex, strong_sum, job->strong_sum_len);
        rs_trace("sent weak sum 0x%08x and strong sum %s", weak_sum,
                 strong_sum_hex);
    }
	*/
    job->stats.sig_blocks++;

    return RS_RUNNING;
}
예제 #3
0
파일: emit.c 프로젝트: opieproject/opie
/*
 * Write the magic for the start of a delta.
 */
void
rs_emit_delta_header(rs_job_t *job)
{
    rs_trace("emit DELTA magic");
    rs_squirt_n4(job, RS_DELTA_MAGIC);
}