~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSMd5.cc

merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
#include <string.h>
56
56
 
57
57
#include "CSDefs.h"
58
 
 
59
58
#include "CSMd5.h"
 
59
#include "CSStrUtil.h"
60
60
 
61
61
#undef BYTE_ORDER       /* 1 = big-endian, -1 = little-endian, 0 = unknown */
62
62
#ifdef ARCH_IS_BIG_ENDIAN
321
321
void
322
322
CSMd5::md5_init()
323
323
{
 
324
        /* Indicates that there is no digest: */
 
325
        digest_cstr[0] = 0;
 
326
 
324
327
    md5_state.count[0] = md5_state.count[1] = 0;
325
328
    md5_state.abcd[0] = 0x67452301;
326
329
    md5_state.abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
339
342
                return;
340
343
        }
341
344
        
342
 
        
343
345
   /* Update the message length. */
344
346
    md5_state.count[1] += nbytes >> 29;
345
347
    md5_state.count[0] += nbits;
368
370
}
369
371
 
370
372
 
371
 
void
372
 
CSMd5::md5_digest(Md5Digest *digest)
 
373
void CSMd5::md5_digest()
373
374
{
374
375
    static const u_char pad[64] = {
375
376
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
388
389
    /* Append the length. */
389
390
    md5_append(data, 8);
390
391
    for (i = 0; i < 16; ++i)
391
 
                digest->val[i] = (u_char)(md5_state.abcd[i >> 2] >> ((i & 3) << 3));
 
392
                digest[i] = (u_char)(md5_state.abcd[i >> 2] >> ((i & 3) << 3));
 
393
 
 
394
        /* Generate the text version: */
 
395
        cs_bin_to_hex(MD5_CHECKSUM_STRING_SIZE, digest_cstr, MD5_CHECKSUM_SIZE, digest);
392
396
}