示例#1
0
  void testHash ()
  {
    char out[33];
    md5->init ();
    md5->update (msg, strlen (msg));
    char *ret = md5->end (out);

    CPPUNIT_ASSERT_EQUAL (ret, &out[0]);

    CPPUNIT_ASSERT_EQUAL (memcmp (expected, out, 32), 0);
  }
示例#2
0
  void testHashMemBuf ()
  {
    MemBuf buffer;
    char out[33];
    buffer << msg;

    md5->init ();
    md5->update (buffer);
    char *ret = md5->end (out);

    CPPUNIT_ASSERT_EQUAL (ret, &out[0]);

    CPPUNIT_ASSERT_EQUAL (memcmp (expected, out, 32), 0);
  }