Results 1 to 8 of 8

Thread: VB6 - Simple Hash Program

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,521

    VB6 - Simple Hash Program

    Attached is a program to calculate the various hash values for a string or a binary file. This can be useful if you are downloading an executable file (.exe/.dll etc) and the author has provided a hash value under a different cover. This allows you to verify that the code has not been tampered with, which is not all that uncommon an occurrence these days. Personally, I would recommend nothing less than SHA256, which is why I have made it the default.

    The InkEdit controls used support Unicode, and you can choose whether to use ASCII (7 bits) or Unicode (16 bits) for the text hash. They will give different answers.

    Edit: Tested on Win Vista, Win 8.1 & Win 10

    J.A. Coutts
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by couttsj; Jan 20th, 2018 at 04:45 PM.

  2. #2
    Fanatic Member
    Join Date
    Apr 2015
    Location
    Finland
    Posts
    679

    Re: VB6 - Simple Hash Program

    Hashing works ok, however had to switch intrinsic VB6 textbox control, as for the some reason inkedit control does not work in Windows 7 system tested.

    Code:
    Private Sub txtInput_GotFocus()
        txtFile.Text = ""
    End Sub
    Generates - Method 'Text' of object 'IInkedit' failed run-time error -2147467259 (80004005). Inked.dll version is 6.1.7601.23403 (11.6.2016)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,521

    Re: VB6 - Simple Hash Program

    Quote Originally Posted by Tech99 View Post
    Hashing works ok, however had to switch intrinsic VB6 textbox control, as for the some reason inkedit control does not work in Windows 7 system tested.

    Generates - Method 'Text' of object 'IInkedit' failed run-time error -2147467259 (80004005). Inked.dll version is 6.1.7601.23403 (11.6.2016)
    I have no idea. I tested it on Win 8.1 & Win 10. There appears to be functional changes that exist between different operating systems. It could be a timing issue as the InkEdit control does not work exactly like a regular text box. For example, I had to use the KeyDown function instead of KeyPress, as it appears the characters have already been displayed when the KeyPress event is activated. You could try a delay function similar to what I had to use when activating hyperlinks and spell check using the Inkedit Control. Unfortunately I do not have a Win 7 system to test it on.

    J.A. Coutts

  4. #4
    Member Dragokas's Avatar
    Join Date
    Aug 2015
    Location
    Ukraine
    Posts
    740

    Re: VB6 - Simple Hash Program

    Tech99, I started VMWare Win 7x32 without MS Updates.
    couttsj's program is working after placing COMDLG32.OCX (v.6.1.97.82) next to exe and launching exe as admin.

    couttsj, thanks for example.
    I would recommend to remark a support: Windows Vista+.
    Malware analyst, VirusNet developer, HiJackThis+ author || my CodeBank works

  5. #5
    Fanatic Member
    Join Date
    Apr 2015
    Location
    Finland
    Posts
    679

    Re: VB6 - Simple Hash Program

    Yes, that 'dreaded' 80004005 error, usually has something to do with credentials. I was running code in IDE, now compiled and tested it running elevated and comdlg32.ocx (v 6.1.98.16) copied to same folder. Still generates same 80004005 error.

  6. #6
    Fanatic Member
    Join Date
    Apr 2021
    Posts
    555

    Re: VB6 - Simple Hash Program

    Quote Originally Posted by couttsj View Post
    Attached is a program to calculate the various hash values for a string or a binary file
    Nice little app (on its own, it's useful to me as it is)...I see you include SHA512, but would HMAC-SHA512 (a version where you give it a seed string to use to encrypt the hash) be possible? I assume it would be a simple process to do, but don't understand enough about hashing/encryption to get my head around it (I might work it out before you reply, it's late here so that might be why I can't get to grips with it )

  7. #7
    Fanatic Member
    Join Date
    Apr 2021
    Posts
    555

    Re: VB6 - Simple Hash Program

    Quote Originally Posted by SmUX2k View Post
    Nice little app (on its own, it's useful to me as it is)...I see you include SHA512, but would HMAC-SHA512 (a version where you give it a seed string to use to encrypt the hash) be possible? I assume it would be a simple process to do, but don't understand enough about hashing/encryption to get my head around it (I might work it out before you reply, it's late here so that might be why I can't get to grips with it )
    Ironically I did a bit of digging and found https://www.vbforums.com/showthread....=1#post4990165 ...a post by YOU that seems to provide exactly what I was after! I'll have to check it out in the morning though, well past 1am here :-)

  8. #8
    New Member
    Join Date
    Apr 2020
    Posts
    2

    Re: VB6 - Simple Hash Program

    I used the .NET class "System.Security.Cryptography.SHA384Managed" for creating a SHA384 Hash

    Code:
    Set shaM = CreateObject("System.Security.Cryptography.SHA384Managed")   
    lArrayHash = shaM.ComputeHash_2(lArray)
    Since .NET 5 there are no COM-Interfaces by default if .NET Framework 4.8 isn't installed. So I had to find a alterativ to create a SHA384 Hash.
    Your Simple Hash Tool was a perfect solution - Thank you very much!
    Great job!

    Cheers Peter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width