This is one of those that comes up periodically - check the archives for a fuller explanation, but the main thing is that you're calculating the checksum of the file including the checksum inside the file. Not the same thing, so not the same checksum.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Christopher Mason Sent: Tuesday, April 14, 2009 11:21 PM To: [email protected] Subject: [spctools-discuss] SHA1 calculation Hi. I'm trying to track down a problem I'm seeing with the SHA1 calculation in ReAdW. Could someone please verify that ReAdW is outputting the correct SHA1 checksum for the RAW file? <parentFile fileName="FT20080305_2bsa_080305125224.RAW" fileType="RAWData" fileSha1="c5909a77ff7f38672e31b1fcda64679ef85e973d" /> C:\nist\src\ReAdw4Mascot2>c:\fciv.exe -sha1 -add FT20080305_2bsa_080305125224.RAW 6393ee48f434e21861f25ee8659dcade8b659646 ft20080305_2bsa_080305125224.raw I've tried both the binary ReAdW-4.2.1 and the code in http://sashimi.svn.sourceforge.net/viewvc/sashimi/trunk/trans_proteomic_pipe line/src/util/SHA1_TPP.cpp?revision=4150&view=markup Technical details: From the code: === Test Vectors (from FIPS PUB 180-1) === "abc" A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D Using fciv [1]: >type test abc >c:\fciv.exe -sha1 -add test a9993e364706816aba3e25717850c26c9cd0d89d test However, if I add this code to ReAdW.cpp: if (!strcmp(argv[fileArg], "-sha1")) { if (fileArg < argc -1) { SHA1 sha; char * c = "abc"; sha.Update((unsigned char*)c, 3); sha.Final(); char foo[22]; foo[0] = 0; sha.ReportHash( foo , SHA1::REPORT_HEX ); cout << foo << "\t" << "abc" << endl; getchar(); } } I get: 14c20690f653fb16396e4f804c9dafb46e513d4f abc ??? I'm compiling ReAdW using visual studio 2005. I've tried with and without optimization... I get the same result if I put 'abc' in a file and use sha.HashFile(). Any ideas what might be going on? Could this be because of unsigned/signed chars? Thanks! -c [1] http://download.microsoft.com/download/c/f/4/cf454ae0-a4bb-4123-8333-a1b6737 712f7/windows-kb841290-x86-enu.exe -- Christopher Mason Proteome Software (503) 244-6027 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "spctools-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/spctools-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
