.NET Framework Bookmark and Share   
 index > Building Development and Diagnostic Tools for .Net > Match checksum GUID to a hashing algorithm
 

Match checksum GUID to a hashing algorithm

Hi,

The ISymUnmanagedDocument::getCheckSumAlgorithmId function returns checksum type in GUID http://msdn.microsoft.com/en-us/library/ms232577.aspx. Is there a way (some public API) to match this GUID to a hashing algorithm, like MD5 and etc?
For example, IDiaSourceFile::get_checksumType returns a value that can be mapped on CryptoAPI Label http://msdn.microsoft.com/en-us/library/e96az21x.aspx. Is it possible to do that with value returned by getCheckSumAlgorithmId

Thanks.

-- DP
dpravnn
I'm not aware of any such API, but CorSym.idl defines 2 standard GUIDs (whichare exactly the two possible algorithms that IDiaSourceFile::get_checksumType can return):
/* ------------------------------------------------------------------------- *
 * Guids for known Source Hash Algorithms
 * ------------------------------------------------------------------------- */
cpp_quote("EXTERN_GUID(CorSym_SourceHash_MD5,  0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99);")
cpp_quote("EXTERN_GUID(CorSym_SourceHash_SHA1, 0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60);")

So just checking against one of those guids should be sufficient for your purposes.

I think the reason diasymreader (ISymUnmanaged* APIs) uses a GUID instead of the simple numbers used by DIA (which DiaSymReader is built on top of), is that DiaSymReader can also be used to write PDBs - so there is no central authority for all possible values here (unlike for native PDBs which only Microsoft tools can generate).

Hope this helps,
Rick

All Replies

  • Tuesday, September 01, 2009 4:31 AMRick ByersMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    I'm not aware of any such API, but CorSym.idl defines 2 standard GUIDs (whichare exactly the two possible algorithms that IDiaSourceFile::get_checksumType can return):
    /* ------------------------------------------------------------------------- *
     * Guids for known Source Hash Algorithms
     * ------------------------------------------------------------------------- */
    cpp_quote("EXTERN_GUID(CorSym_SourceHash_MD5,  0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99);")
    cpp_quote("EXTERN_GUID(CorSym_SourceHash_SHA1, 0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60);")
    

    So just checking against one of those guids should be sufficient for your purposes.

    I think the reason diasymreader (ISymUnmanaged* APIs) uses a GUID instead of the simple numbers used by DIA (which DiaSymReader is built on top of), is that DiaSymReader can also be used to write PDBs - so there is no central authority for all possible values here (unlike for native PDBs which only Microsoft tools can generate).

    Hope this helps,
    Rick
  • Friday, September 04, 2009 8:11 AMdpravnn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you! That is exactly what I need.

    DP
    Thanks, DP
Rick Byers

You can use google to search for other answers

Custom Search

More Threads

• Can someone help me with remote processes?
• Custom CLR Profiler - help with design
• IronPython output is missing
• Profiler - building functionID/function signature map
• Profiler: Get Main entry point
• ICorProfilerCallback learning : Please help get me started
• Query on using enterprise library For logging
• Creating A Helper Thread
• Multithread stepping
• IMetaDataEmit.DefineTypeRefByName for generic types?