Usine EbCrypt to Create SHA1 hash

I'm trying to use EbCrypt (freeware from ebcrypt.com)  to generate a file hash but I'm getting the incorrect hash back.    My code is below - the file size is 65536 (as it's the first part of a large file (I'm replicating BitTorrent's hashin).  I've tried blob as data type Byte and I've tried using HashBlob instaed of HashString

Any takers? Thanks.

Dim hsh As ebCryptLib.eb_c_Hash
Dim blob As String
Dim retVal1 As String

Private Sub Form_Load()
Set hsh = CreateObject("EbCrypt.eb_c_Hash")
blob = Space(65536)

Open ".\temp\part" For Binary As #1


Get #1, 1, blob


Close #1


retVal1 = hsh.HashString(ebCryptLib.EB_CRYPT_HASH_ALGORITHM_SHA1, blob)

End Sub
videodamAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

videodamAuthor Commented:
Help!
TaconvinoCommented:
Try this:

Dim hsh As ebCryptLib.eb_c_Hash
Dim blob(65536) As Byte
Dim retVal1 As String

Private Sub Form_Load()
Set hsh = CreateObject("EbCrypt.eb_c_Hash")

Open ".\temp\part" For Binary As #1

Get #1, 1, blob
Close #1

retVal1 = hsh.HashString(ebCryptLib.EB_CRYPT_HASH_ALGORITHM_SHA1, blob)

End Sub

+TCV
TaconvinoCommented:
Sorry!  You should use HashBLOB for this case.

+TCV

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
videodamAuthor Commented:
Thanks Taconvino.  We have the solution so I will close the question (although we did try what you suggest).

The answer is in the Dim blob(65536) As Byte statement - this produces a variable of length 65537 (due to element 0) and since we're trying to hash a 64K chunk it comes out wrong.  If Dim blob (65535) is used the hashes work out.

Thanks again for your response.
TaconvinoCommented:
Right!! That naughty zero element!  I will keep that in mind for the future!

+TCV
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.