Generating String and File Hashes Using VBA

I created a class for generating string and file hashes using VBA and the cryptographic api.

MD2, MD4, MD5, SHA1, SHA256, SHA384, and SHA512 hash algorithms are supported. The MD5 algorithm is used by default. The class supports both 32 and 64-bit versions of Office.

Example Usage :

    Dim cH As clsHash
    Dim sHash As String

    Set cH = New clsHash
    sHash = cH.HashString("foobar")

Result:
3858F62230AC3C915F300C664312C63F

6 thoughts on “Generating String and File Hashes Using VBA”

  1. environtment:
    Windows XP 32 bit
    Access 2002

    result:
    MD2 … SHA1 – OK
    SHA256 … SHA512 – failure.

    cheers

  2. I don’t care to admit how many hours I’ve spent looking for a hash implementation that just works. You’ve done it. This is spectacular. Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.