~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Patrick Crews
  • Date: 2010-09-14 20:21:03 UTC
  • mto: (1771.1.1 pcrews)
  • mto: This revision was merged to the branch mainline in revision 1772.
  • Revision ID: gleebix@gmail.com-20100914202103-1db2n0bshzafep19
Moved transaction_log tests into updated non-publisher-based tree

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
 
58
59
#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
 
 
327
324
    md5_state.count[0] = md5_state.count[1] = 0;
328
325
    md5_state.abcd[0] = 0x67452301;
329
326
    md5_state.abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
342
339
                return;
343
340
        }
344
341
        
 
342
        
345
343
   /* Update the message length. */
346
344
    md5_state.count[1] += nbytes >> 29;
347
345
    md5_state.count[0] += nbits;
370
368
}
371
369
 
372
370
 
373
 
void CSMd5::md5_digest()
 
371
void
 
372
CSMd5::md5_digest(Md5Digest *digest)
374
373
{
375
374
    static const u_char pad[64] = {
376
375
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
389
388
    /* Append the length. */
390
389
    md5_append(data, 8);
391
390
    for (i = 0; i < 16; ++i)
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);
 
391
                digest->val[i] = (u_char)(md5_state.abcd[i >> 2] >> ((i & 3) << 3));
396
392
}