2010-05-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Left only IANA hash function textual name in messageDigest.cc.
	Assign only IANA hash function textual name to Checksum and
	ChunkChecksum. Fixed the value of MessageDigestContext::MD5.
	* src/Checksum.h
	* src/MetalinkParserController.cc
	* src/messageDigest.cc
	* src/messageDigest.h
	* test/IteratableChecksumValidatorTest.cc
	* test/IteratableChunkChecksumValidatorTest.cc
	* test/MessageDigestHelperTest.cc
	* test/Metalink2RequestGroupTest.cc
	* test/MetalinkProcessorTest.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2010-05-14 14:11:56 +00:00
parent 88475a6aa0
commit b305edd7c5
10 changed files with 99 additions and 51 deletions

View file

@ -4,6 +4,7 @@
#include "util.h"
#include "DefaultDiskWriter.h"
#include "messageDigest.h"
namespace aria2 {
@ -33,23 +34,27 @@ void MessageDigestHelperTest::testDigestDiskWriter() {
(new DefaultDiskWriter("4096chunk.txt"));
diskio->openExistingFile();
CPPUNIT_ASSERT_EQUAL(std::string("608cabc0f2fa18c260cafd974516865c772363d5"),
MessageDigestHelper::digest("sha1", diskio, 0, 4096));
MessageDigestHelper::digest
(MessageDigestContext::SHA1, diskio, 0, 4096));
CPPUNIT_ASSERT_EQUAL(std::string("7a4a9ae537ebbbb826b1060e704490ad0f365ead"),
MessageDigestHelper::digest("sha1", diskio, 5, 100));
MessageDigestHelper::digest
(MessageDigestContext::SHA1, diskio, 5, 100));
}
void MessageDigestHelperTest::testDigestFilename()
{
CPPUNIT_ASSERT_EQUAL(std::string("608cabc0f2fa18c260cafd974516865c772363d5"),
MessageDigestHelper::digest("sha1", "4096chunk.txt"));
MessageDigestHelper::digest
(MessageDigestContext::SHA1, "4096chunk.txt"));
}
void MessageDigestHelperTest::testDigestData()
{
std::string data = "aria2";
CPPUNIT_ASSERT_EQUAL(std::string("f36003f22b462ffa184390533c500d8989e9f681"),
MessageDigestHelper::digest("sha1", data.c_str(), data.size()));
MessageDigestHelper::digest
(MessageDigestContext::SHA1, data.c_str(), data.size()));
}
} // namespace aria2