• PowerShell Hashing Tool

    Home » Forums » Tools » PowerShell Hashing Tool

    Author
    Topic
    #2210597

    Hey Y’all,

    Continuing my social distancing I’ve combined two of my file hashing scripts into a single script that will both check and generate file hashes. The program has a -setup switch that will automatically generate a desktop shortcut to run the program and also add an entry into the SendTo menu to allow you to select a file in file explorer and send it to the program.

    When generating a hash it will report it and also copy it to the clipboard for your convenience.

    For downloaded files just paste the provided hash value into the field, after selecting the hash algorithm and it will tell you if it matches the newly calculated value.

    After downloading the file and unzipping it, in PowerShell enter: get-help [d:path]Check-FileHash.ps1 -full  and read the included documentation.

    Check-FileHash.zip: Download the latest version from my OneDrive Library.

    HTH 😎

    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!
    Computer Specs

    • This topic was modified 3 years, 11 months ago by RetiredGeek.
    • This topic was modified 3 years, 11 months ago by RetiredGeek.
    • This topic was modified 1 year, 9 months ago by RetiredGeek. Reason: Updated file location to my OneDrive Library
    3 users thanked author for this post.
    Viewing 5 reply threads
    Author
    Replies
    • #2210949

      Hey Y’all,

      Sorry the brain just won’t shut down some times. Here’s version 6.1.

      What’s new:

      • Wider menu & text fields so you can see longer file specs.
      • Paste Hash button that will appear if there is text on the clipboard and allow you to paste it in. Of course, the program can’t tell if the clipboard contains a hash or something else, that’s up to you!
      • Replaced OK button with a context sensitive button. When you select or pass a file it will show as Generate. If you add a Hash it will change to Check. If you use the Paste Hash button this will happen automatically. If you type the hash in (who would want to do that) you need to use the tab key to change the button, but if you just click it it will still check the hash vs generate a new one.

      Check-Hash.zip: See OP for link!

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • This reply was modified 3 years, 11 months ago by RetiredGeek.
      • This reply was modified 1 year, 9 months ago by RetiredGeek. Reason: Updated for file location
    • #2210956

      RG – You’re just showing off now. 🙂

      But seriously, dead impressed… thank you.

      Of course, the program can’t tell if the clipboard contains a hash or something else

      Given that hashes follow a regular pattern, can you not use RegEx to check/filter the clipboard contents?

      • #2210957

        Rick,

        I’m not really up on RegEx and since there are several algorithms I don’t really know how to do it. I’ve done some very very basic RegEx but it still twists my brain in knots. Reminds me of algebra a+b*c, just give me the d…m numbers already! LOL

        I do however check the length of the hash once it is entered to make sure it matches the selected algorithm.

        If you need a project for social distancing give it a go. I’ll be more than happy to incorporate it with credit!

        😎

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

    • #2210967

      I bought all of Jack Dunnings’ books – a bundle including A Beginner’s Guide to Using Regular Expressions in AutoHotkey.

      I fell at the first hurdle…  🙁

      … so don’t hold your breath! ROFL

    • #2211154

      Rick,

      Check clipboard for hash value…DONE!

      Sorry, can’t let a challenge go. I had a boss who knew and exploited that to no end. LOL

      # Check to see if clipboard contains a valid HEX value!
      $CBVal = Get-Clipboard
      $CBLen = $CBVal.Length
      $CKLen = (& {Switch ($CBLen) {
                            16 {$True ; Break}
                            32 {$True ; Break}
                            40 {$True ; Break}
                            64 {$True ; Break}
                            96 {$True ; Break}
                           128 {$True ; Break}
                       Default {$False}
                          }
                         } 
                      )
      If ($CKLen -eq $True) {
        $CBHex = $CBVal -match "^[0-9A-Fa-f]"
      }
      Else {$CBHex = $False}
      

      Note: if the pasted hash’s length does not match the length required by the algorithm you’ll get a message to that effect and the hash field will be cleared. However, you can still use the button to re-paste it after you change the algorithm.

      HTH 😎

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • This reply was modified 3 years, 11 months ago by RetiredGeek.
      • This reply was modified 3 years, 11 months ago by RetiredGeek.
    • #2211165

      Sorry, can’t let a challenge go.

      There you go… I had every confidence in you. 🙂

      (And I know exactly what you mean… I had a similar boss. Darn those NLP courses he went on…)

    • #2379719

      Hey Y’all,

      If you’re interested in a PowerShell alternative you can checkout this thread.

      Note: It does not support as many algorithms as GTKHash but it does support the most common. Also it has NOT1 been tested on Linux so if someone would test it I’d be much appreciative! It does run on PowerShell Core V7.1.3 and uses Xaml menus so I would think it would run on Linux.

      I’ve also added the latest version to my OneDrive archive where you can download it along with other PowerShell utilities I’ve created. All are free w/o limitation although if reuse the code attribution would be appreciated.

      HTH 😎

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • This reply was modified 2 years, 7 months ago by Microfix.
      • This reply was modified 1 year, 9 months ago by RetiredGeek. Reason: Updated file download location
    Viewing 5 reply threads
    Reply To: PowerShell Hashing Tool

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: