예제 #1
0
파일: sumd5.cpp 프로젝트: leeeqian/csuneido
Value BuiltinClass<Md5>::callclass(BuiltinArgs& args)
	{
	args.usage("usage: Md5(@strings)");
	Md5* a = new BuiltinInstance<Md5>();
	if (! args.hasUnnamed())
		return a;
	while (Value x = args.getNextUnnamed())
		a->update(x.gcstr());
	return new SuString(a->value());
	}
예제 #2
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);
  }
예제 #3
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);
  }