Giter Club home page Giter Club logo

filehasher's Introduction

FileHasher

Create and compare hashes of files and / or text.
Generate the hashes of the files you want (e.g. .exe and .dll) and compare this hash to the one generated at runtime.
By doing so you can detect updates for any game / software without relying on strings or version numbers inside the file. This approach also never touches the file in memory, it only reads it from the disk.
For the download and information on how to use the GUI or the CLI tool please see Releases

MSBuild CodeQL

Speed:

In order to know what to expect in terms of performance, I did some tests for SHA256 with a blocksize of 16777216 (2^24) Bytes. SHA512 will be significantly faster, since we only have to do half of the iterations that SHA256 does. There is no real reason to use a larger blocksize, however other sizes may perform better on different hardware.
These measurements were done with the release version of the Console file, the GUI will be slower (more threads, synchronization, etc...)

FileSize (KB) Runtime (ms)
14847574 54654
5186093 19142
3770744 13941
1039630 3833
431357 1615
103972 389
1245 5.1
115 0.7

GUI:

GUI_Preview

Sources:

The only sources used are:

External

I am using Qt for the GUI and QtFramelessWindowDarkStyle for the dark mode.
Download the Qt Installer and install version 15.5.0, add the project files in FileHasherUI and you should be good to go
(you will need to keep the whole project's folder structure, or make appropiate changes to the .pro file).

filehasher's People

Contributors

alescher avatar

Stargazers

 avatar  avatar

Watchers

 avatar

filehasher's Issues

Add Compare with clipboard feature

When right-clicking on a row in the Output box, there should be an option "Compare to clipboard" which compares the selected hash to the string that is currently saved in the user's clipboard, showing whether they match or not.

Allow Output to be exported as json

  • Add "Export to Json" to Output's tool button
  • Structure:
{
    "FileHasherUI.exe": {
        "filePath": "C:/Dev/Cpp/FileHasher/GUI/build-FileHasherUI-Qt_15_5_0_Static-Release/release/FileHasherUI.exe",
        "fileSizeKB": 12228,
        "hashes": {
            "MD5": "bc7f5871a70ab13d5882a4a5b45fc7b9",
            "SHA256": "831f73f1693a9778bccb17e5063372817d3e65abd6164854c2a44315418861f2",
            "SHA512": "c0b087228352f4350e30b30fb7e906a455a6689409e89662786fde8bd575ecd5e1b27f8482e7016d10229e2f1919d8d752cb95e43180f158e8d0696a30f84a99"
        }
    }
}
  • Will need to change the Controller's cache to an unordered map

Improve Export functionality

It isn't obvious or easily understandable that the Export buttons will export the content to the user's clipboard.
Exporting to the clipboard is currently also the only available option, which may make sense for the C-Array but not so much for JSON.
It would be better if upon clicking on "Export as ...", a new window would open, containing the following:

  • A textbox containing the exported string
  • A "Copy to Clipboard" button
  • A "Save as" button that would prompt the user to save the content as a file

This would make it clearer where the exported data ends up, aswell as make it easier to add an Export to file functionality.
What would need to be done:

  • Make a new window (.ui file, etc...)
  • Let this window be opened upon clicking any "Export as ..." button
  • Implement a "save to file" functionality, also letting the user choose the path and filename

Bug when file on disk is deleted

Reproduce:

  • Add file to file list
  • Select hashing algorithms
  • Remove / Rename file from disk (not from the GUI's file list)
  • Click on Generate hashes

The monitoring thread never finishes and the GUI becomes unusable, needs to be killed via Task Manager.

GUI is missing some error checking

The GUI currently doesn't react properly if errors happen in the background.
For example, the background will return an empty string on error.
The Hashing thread should be able to report errors to the Controller.
This won't be achievable for the Monitoring thread since that one will be blocking. This could be solved by:

  • having a timeout, if after a set amount of time the Monitoring thread does not register any progress, it aborts
  • letting the Backend set the process bytes to the file size, this would let the Monitoring thread terminate correctly, the error would then be handled by the Hashing thread

Don't use QProgressBar's percentage calculation

Since QProgressBar only takes signed 32 integers as in QProgressBar::minimum(), QProgressBar::maximum() and QProgressBar::value(), these methods should not be used. Instead, the percentage should be calculated separately (with 64 bit unsigned integers) and then set the percentage with QProgressBar::setFormat() even though this is not the intended way.

Critical bug when trying to hash a 0 Byte file.

Programm becomes unusable after trying to hash a file with 0 bytes in size.

Steps to reproduce:

  1. create an empty txt file
  2. add that file to the hash list
  3. click generate hash
  4. programm will freeze and not be able to generate any further hashes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.