From: Foster B. <fos...@us...> - 2006-02-03 18:21:01
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/md5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/test/md5 Modified Files: check_md5.cpp main.cpp md5_smoke.sh Log Message: asl 1.0.13 Index: md5_smoke.sh =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/test/md5/md5_smoke.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** md5_smoke.sh 3 Jun 2005 16:35:46 -0000 1.1 --- md5_smoke.sh 3 Feb 2006 18:20:48 -0000 1.2 *************** *** 2,11 **** if [ "$1" == "" ]; then ! echo "usage: $0 [ file ]" ! echo " compares the ASL MD5 hash function with OpenSSL MD5." ! echo " Note: you must have the md5_asl binaries compiled" ! echo " before you can use this smoke test." ! exit 1; fi --- 2,11 ---- if [ "$1" == "" ]; then ! echo "usage: $0 [ file ]" ! echo " compares the ASL MD5 hash function with OpenSSL MD5." ! echo " Note: you must have the md5_asl binaries compiled" ! echo " before you can use this smoke test." ! exit 1; fi *************** *** 16,41 **** for TEST_EXE in "./bindebug/md5_asl" "./bin/md5_asl" ; do ! if [ -x $TEST_EXE ]; then ! TEST_RESULT=`$TEST_EXE $1` ! ! if [ "$OPENSSL_RESULT" == "$TEST_RESULT" ]; then ! echo "##### PASS ##### ($TEST_EXE)" ! else ! echo "##### FAIL ##### ($TEST_EXE)" ! fi ! echo " ASL: $TEST_RESULT" ! else ! echo "##### NO TEST ##### ($TEST_EXE)" ! echo " Executable '$TEST_EXE' could not be found and was not tested" ! fi done --- 16,41 ---- for TEST_EXE in "./bindebug/md5_asl" "./bin/md5_asl" ; do ! if [ -x $TEST_EXE ]; then ! TEST_RESULT=`$TEST_EXE $1` ! ! if [ "$OPENSSL_RESULT" == "$TEST_RESULT" ]; then ! echo "##### PASS ##### ($TEST_EXE)" ! else ! echo "##### FAIL ##### ($TEST_EXE)" ! fi ! echo " ASL: $TEST_RESULT" ! else ! echo "##### NO TEST ##### ($TEST_EXE)" ! echo " Executable '$TEST_EXE' could not be found and was not tested" ! fi done Index: main.cpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/test/md5/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.cpp 6 Jan 2006 18:35:26 -0000 1.2 --- main.cpp 3 Feb 2006 18:20:48 -0000 1.3 *************** *** 1,6 **** /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ --- 1,6 ---- /* ! Copyright 2005-2006 Adobe Systems Incorporated ! Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt ! or a copy at http://opensource.adobe.com/licenses.html) */ *************** *** 20,74 **** int main(int argc, char* argv[]) { ! if (argc <= 1) ! { ! std::cout << "usage: " << argv[0] << " [ file ]" << std::endl; ! std::cout << " generate the MD5 hash of a file" << std::endl; ! std::cout << " Adobe Source Libraries v" << ADOBE_VERSION_MAJOR << "." << ADOBE_VERSION_MINOR << "." << ADOBE_VERSION_SUBMINOR << std::endl; ! std::cout << " Boost v" << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl; ! return 1; ! } ! bool success(false); ! try ! { ! adobe::md5_t m; ! boost::filesystem::path file_path(argv[1], boost::filesystem::native); ! std::ifstream stream(file_path.native_file_string().c_str(), std::ios::binary | std::ios::in); ! while (stream.good()) ! { ! boost::array<std::ifstream::char_type, 256*1024> buffer; ! stream.read(&buffer[0], static_cast<std::streamsize>(buffer.size())); ! std::streamsize gcount(stream.gcount()); ! if (gcount > 0) m.update(&buffer[0], static_cast<std::size_t>(gcount)); ! } ! adobe::md5_t::digest_t hash(m.final()); ! adobe::md5_t::digest_t::iterator first(hash.begin()); ! adobe::md5_t::digest_t::iterator last(hash.end()); ! std::cout << "MD5(" << argv[1] << ")= "; ! for(; first != last; ++first) ! { ! std::cout.width(2); ! std::cout.fill('0'); ! std::cout << std::hex << static_cast<int>(*first); ! } ! std::cout << std::endl; ! success = true; ! } ! catch( const std::exception& error ) ! { std::cerr << "Exception: " << error.what() << std::endl; } ! catch( ... ) ! { std::cerr << "Unknown exception" << std::endl; } ! return success ? 0 : 1; } --- 20,74 ---- int main(int argc, char* argv[]) { ! if (argc <= 1) ! { ! std::cout << "usage: " << argv[0] << " [ file ]" << std::endl; ! std::cout << " generate the MD5 hash of a file" << std::endl; ! std::cout << " Adobe Source Libraries v" << ADOBE_VERSION_MAJOR << "." << ADOBE_VERSION_MINOR << "." << ADOBE_VERSION_SUBMINOR << std::endl; ! std::cout << " Boost v" << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl; ! return 1; ! } ! bool success(false); ! try ! { ! adobe::md5_t m; ! boost::filesystem::path file_path(argv[1], boost::filesystem::native); ! std::ifstream stream(file_path.native_file_string().c_str(), std::ios::binary | std::ios::in); ! while (stream.good()) ! { ! boost::array<std::ifstream::char_type, 256*1024> buffer; ! stream.read(&buffer[0], static_cast<std::streamsize>(buffer.size())); ! std::streamsize gcount(stream.gcount()); ! if (gcount > 0) m.update(&buffer[0], static_cast<std::size_t>(gcount)); ! } ! adobe::md5_t::digest_t hash(m.final()); ! adobe::md5_t::digest_t::iterator first(hash.begin()); ! adobe::md5_t::digest_t::iterator last(hash.end()); ! std::cout << "MD5(" << argv[1] << ")= "; ! for(; first != last; ++first) ! { ! std::cout.width(2); ! std::cout.fill('0'); ! std::cout << std::hex << static_cast<int>(*first); ! } ! std::cout << std::endl; ! success = true; ! } ! catch( const std::exception& error ) ! { std::cerr << "Exception: " << error.what() << std::endl; } ! catch( ... ) ! { std::cerr << "Unknown exception" << std::endl; } ! return success ? 0 : 1; } Index: check_md5.cpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/test/md5/check_md5.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** check_md5.cpp 3 Jun 2005 16:35:45 -0000 1.1 --- check_md5.cpp 3 Feb 2006 18:20:48 -0000 1.2 *************** *** 14,76 **** int main(int argc, char* argv[]) { ! if (argc != 3) { ! std::cout << "usage: " << argv[0] << " hash file " << std::endl; ! std::cout << " check the MD5 hash of a file" << std::endl; ! std::cout << " Adobe Source Libraries v" << ADOBE_VERSION_MAJOR ! << "." << ADOBE_VERSION_MINOR << "." << ADOBE_VERSION_SUBMINOR << std::endl; ! std::cout << " Boost v" << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 ! << "." << BOOST_VERSION % 100 << std::endl; ! ! return 1; ! } ! bool success = false; ! try ! { ! adobe::md5_t m; ! boost::filesystem::path file_path(argv[2], boost::filesystem::native); ! boost::filesystem::ifstream stream(file_path, std::ios::binary | std::ios::in); ! while (stream.good()) ! { ! boost::array<std::ifstream::char_type, 256*1024> buffer; ! stream.read(&buffer[0], static_cast<std::streamsize>(buffer.size())); ! std::streamsize gcount(stream.gcount()); ! if (gcount > 0) m.update(&buffer[0], static_cast<std::size_t>(gcount)); ! } ! adobe::md5_t::digest_t hash(m.final()); ! adobe::md5_t::digest_t::iterator first(hash.begin()); ! adobe::md5_t::digest_t::iterator last(hash.end()); ! std::string actual; ! std::ostringstream oss(actual); ! for(; first != last; ++first){ ! oss.width(2); ! oss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*first); ! } ! ! std::string expected(argv[1]); ! std::string::iterator e(expected.begin()); ! success = oss.str() == expected; ! if(!success) ! std::cout << "Expected: " << expected ! << " actual: " << oss.str() << std::endl; ! ! } ! catch( const std::exception& error ) ! { ! std::cerr << "Exception: " << error.what() << std::endl; ! } ! catch( ... ) ! { ! std::cerr << "Unknown exception" << std::endl; ! } ! return success ? 0 : 1; } --- 14,76 ---- int main(int argc, char* argv[]) { ! if (argc != 3) { ! std::cout << "usage: " << argv[0] << " hash file " << std::endl; ! std::cout << " check the MD5 hash of a file" << std::endl; ! std::cout << " Adobe Source Libraries v" << ADOBE_VERSION_MAJOR ! << "." << ADOBE_VERSION_MINOR << "." << ADOBE_VERSION_SUBMINOR << std::endl; ! std::cout << " Boost v" << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 ! << "." << BOOST_VERSION % 100 << std::endl; ! ! return 1; ! } ! bool success = false; ! try ! { ! adobe::md5_t m; ! boost::filesystem::path file_path(argv[2], boost::filesystem::native); ! boost::filesystem::ifstream stream(file_path, std::ios::binary | std::ios::in); ! while (stream.good()) ! { ! boost::array<std::ifstream::char_type, 256*1024> buffer; ! stream.read(&buffer[0], static_cast<std::streamsize>(buffer.size())); ! std::streamsize gcount(stream.gcount()); ! if (gcount > 0) m.update(&buffer[0], static_cast<std::size_t>(gcount)); ! } ! adobe::md5_t::digest_t hash(m.final()); ! adobe::md5_t::digest_t::iterator first(hash.begin()); ! adobe::md5_t::digest_t::iterator last(hash.end()); ! std::string actual; ! std::ostringstream oss(actual); ! for(; first != last; ++first){ ! oss.width(2); ! oss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*first); ! } ! ! std::string expected(argv[1]); ! std::string::iterator e(expected.begin()); ! success = oss.str() == expected; ! if(!success) ! std::cout << "Expected: " << expected ! << " actual: " << oss.str() << std::endl; ! ! } ! catch( const std::exception& error ) ! { ! std::cerr << "Exception: " << error.what() << std::endl; ! } ! catch( ... ) ! { ! std::cerr << "Unknown exception" << std::endl; ! } ! return success ? 0 : 1; } |