diff --git a/ACKNOWLEDGEMENTS.md b/ACKNOWLEDGEMENTS.md index e8f79da..fabed0a 100644 --- a/ACKNOWLEDGEMENTS.md +++ b/ACKNOWLEDGEMENTS.md @@ -5,25 +5,31 @@ HashTool would not have been possible without the generous contributions of open All AI-generated content (code suggestions, translations, text) was carefully reviewed, tested, and verified by the author. ### AI Assistance -- **Gemini 3 Pro** (including Jules Agent) (by Google): Provided code suggestions, debugging help, error detection, - and fixes. +- **Gemini 3 Pro** (including Jules Agent) (by Google): Provided code suggestions, debugging help, error detection, and fixes. - **Grok 4.1** (by xAI): Code suggestions, multi-language translations (30+ languages), and assistance in writing documentation/texts (e.g., Disclaimer, Privacy Policy). +- **Claude** (by Anthropic): The 1.2.0 overhaul — new hashing engine, checksum files, command-line tool, tests, CI/CD and release automation, bug fixes, and translations of the new texts. Big thanks to these AIs for speeding up development. ### Third-Party Libraries -HashTool uses the following open-source libraries: +HashTool uses the following open-source libraries. Exact versions are listed on the app's *About* page and in the SBOM files (`*.cdx.json`) attached to every release. + +| Library | Used for | License | +|---|---|---| +| [Avalonia UI](https://github.com/AvaloniaUI/Avalonia) (Avalonia, Desktop, Themes.Fluent, Headless) | Cross-platform user interface | MIT | +| [Inter](https://rsms.me/inter/) via Avalonia.Fonts.Inter | Default font | SIL OFL 1.1 (font), MIT (package) | +| [SkiaSharp](https://github.com/mono/SkiaSharp) and [HarfBuzzSharp](https://github.com/mono/SkiaSharp) | Rendering and text shaping (through Avalonia) | MIT | +| [Tmds.DBus.Protocol](https://github.com/tmds/Tmds.DBus) | Linux desktop integration (through Avalonia) | MIT | +| [Blake3.NET](https://github.com/xoofx/Blake3.NET) | BLAKE3 hashing | BSD 2-Clause | +| [System.IO.Hashing](https://github.com/dotnet/runtime) | xxHash and CRC32 | MIT | +| [CommunityToolkit.Mvvm](https://github.com/CommunityToolkit/dotnet) | MVVM helpers | MIT | +| [Material.Icons.Avalonia](https://github.com/AvaloniaUtils/Material.Icons.Avalonia) | Icons | MIT | +| [Microsoft.Extensions.DependencyInjection / Logging](https://github.com/dotnet/runtime) | Composition and logging | MIT | +| [System.CommandLine](https://github.com/dotnet/command-line-api) | The `hashtool` command-line tool | MIT | +| [Velopack](https://github.com/velopack/velopack) | Installers and automatic updates | MIT | + +Development and CI tools: [xUnit](https://github.com/xunit/xunit), [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet), [Meziantou.Analyzer](https://github.com/meziantou/Meziantou.Analyzer), [ReferenceTrimmer](https://github.com/dfederm/ReferenceTrimmer), [nuget-license](https://github.com/sensslen/nuget-license), [CycloneDX for .NET](https://github.com/CycloneDX/cyclonedx-dotnet), [zizmor](https://github.com/zizmorcore/zizmor), [actionlint](https://github.com/rhysd/actionlint), [gitleaks](https://github.com/gitleaks/gitleaks) and [OpenSSF Scorecard](https://github.com/ossf/scorecard). -- [Avalonia UI](https://github.com/AvaloniaUI/Avalonia) version 11.3.11 – Licensed under the MIT License. -- [Avalonia.Controls.ColorPicker](https://github.com/AvaloniaUI/Avalonia) version 11.3.11 – Licensed under the MIT License. -- [Avalonia.Controls.DataGrid](https://github.com/AvaloniaUI/Avalonia) version 11.3.11 – Licensed under the MIT License. -- [Avalonia.Desktop](https://github.com/AvaloniaUI/Avalonia) version 11.3.11 – Licensed under the MIT License. -- [Avalonia.Fonts.Inter](https://github.com/AvaloniaUI/Avalonia) version 11.3.11 – Licensed under the MIT License / SIL OFL 1.1. -- [Avalonia.Themes.Fluent](https://github.com/AvaloniaUI/Avalonia) version 11.3.11 – Licensed under the MIT License. -- [Blake3.NET](https://github.com/xoofx/Blake3.NET) version 2.2.0 – Copyright © Alexandre Mutel. Licensed under the BSD 2-Clause License. -- [CommunityToolkit.Mvvm](https://github.com/CommunityToolkit/dotnet) version 8.2.1 – Licensed under the MIT License. -- [Material.Icons.Avalonia](https://github.com/AvaloniaUtils/Material.Icons.Avalonia) version 2.4.1 – Licensed under the MIT License. -- [Velopack](https://github.com/velopack/velopack) version 0.0.1298 – Licensed under the MIT License. Thank you to all the maintainers and contributors of these projects. Your work is greatly appreciated. -_© 2026 poli0981. All rights reserved._ \ No newline at end of file +_© 2026 poli0981. All rights reserved._ diff --git a/CHANGELOG.md b/CHANGELOG.md index 901e277..9501690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,55 @@ All notable changes to this project will be documented in this file. +## [1.2.0] - Unreleased + +A big rework under the hood: faster hashing, standard checksum files, a command-line tool, a Linux build and a long list of fixes. + +### Added +- **Checksum files**: save all hashes as one `SHA256SUMS`-style file (GNU, BSD tagged, SFV, JSON or CSV), and verify any checksum file: `sha256sum`/`md5sum` output, BSD tagged lists, `.sfv`, xxhsum (`XXH3_` prefix) and single-hash files such as `image.iso.sha256`. Dropping a checksum file on Verify loads every file it lists. +- **Command-line tool `hashtool`** for Windows, macOS and Linux: `hashtool hash`, `hashtool verify` (like `sha256sum -c`), `hashtool check` and `hashtool algorithms`. +- **Linux** (AppImage) and **Intel Mac** builds. +- **Open files from the system**: optional Explorer context menu on Windows ("Generate hash with Hash Tool", "Verify with Hash Tool"), "Open With" on macOS and `--create`/`--verify` command-line arguments. A second launch hands its files to the window that is already open. +- Settings for files processed at the same time, hard-drive mode, hidden files, hash letter case, default checksum file format and the automatic update check. +- Updates: optional automatic check (at most once a day), release notes, cancellable download, install now or when closing the app. +- "Restart as Administrator" (Windows) when files cannot be read, keeping the file list. +- Developer console: level filter, auto-scroll and export. +- Keyboard shortcuts: Ctrl/⌘+O (add files), Ctrl/⌘+Shift+O (add folder), Ctrl/⌘+F (search), Ctrl/⌘+Enter (run all), Esc (cancel), Delete (remove). +- The window remembers its size and position. + +### Changed +- **CRC32 is shown in the standard byte order** used by 7-Zip, SFV files and `cksum`: "123456789" now gives `CBF43926` (1.1 showed `2639F4CB`). CRC32 values saved by 1.1 still verify and are marked as using the old byte order. +- New hashing engine: each file is read once for all selected algorithms, with large double-buffered reads, and several files are hashed at once (large files in their own lane). In benchmarks SHA-256 of a large file is about 1.7× faster than a plain single-buffer read, and 2,000 small files finish about 3.5× faster than one at a time. +- Adding folders scans in the background, skips unreadable folders and symbolic-link loops, and no longer freezes the window. +- Settings are written safely; a damaged settings file is backed up and reset instead of breaking the app. The chosen language is saved right away. +- Daily log files with ISO timestamps (kept 14 days), user folder names masked, and crash reports. +- Statuses, filters and dialogs follow the selected language immediately, including right-to-left layouts. Automatic language detection picks the right variant (Traditional Chinese for Taiwan and Hong Kong, Latin American Spanish, Norwegian, British English for Australia and others). +- The colour-blind and high-contrast themes also recolour statuses. +- Updated to Avalonia 12, the .NET 10.0.13 runtime, Velopack 1.2 and current versions of every library. + +### Fixed +- Crash when dropping a folder. +- The app closing on unexpected errors, such as saving into a read-only folder; errors are now shown in a dialog. +- Single-letter shortcuts (Shift+A/C/Z) firing while typing. +- The search highlight showing the end of a file name twice. +- Split archives (`.001`, `.7z.002`) being mistaken for hash files. +- "Invalid" when loading a hash file that does not name the file, such as `SHA256SUMS`. +- The expected hash getting lost when a file and its hash file were dropped together. +- Calendar and number formatting in logs for some languages (Thai, Arabic, Turkish). +- Missing, untranslated or misaligned text in several dialogs and languages; the Filipino translation is complete. + +### Removed +- The Free Memory button, Force Quit and its timeout setting. +- Starting as administrator automatically (replaced by "Restart as Administrator" when it is needed). +- The developer (pre-release) update channel and its disclaimer. + +### Security +- Removed the vulnerable Tmds.DBus.Protocol version (GHSA-xrw6-gwf8-vvr9) through the Avalonia upgrade. +- Checksum files cannot point to network (UNC) or device paths, and exported CSV files cannot inject spreadsheet formulas. +- Releases are built and tested in GitHub Actions, with `SHA256SUMS`, SBOMs and build provenance attestations; every pull request is scanned for vulnerable packages, licences and secrets. + +--- + ## [1.1.3] - 2026-02-23 ### Removed @@ -78,7 +127,7 @@ Quick hotfix to make things smoother. Enjoy. #### Create Hash - **Multi-Algorithm Support**: Calculate hashes using MD5, SHA1, SHA256, SHA384, SHA512, and BLAKE3. - **Batch Processing**: Compute hashes for multiple files simultaneously with high performance. -- **File Compression**: Create ZIP archives containing both the original files and their generated hash files. +- **File Compression**: Create ZIP archives of the generated hash files. - **Export**: Save hash results to separate files (e.g., `.sha256`). - **Clipboard Integration**: Quickly copy hash values to the clipboard. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..5a787cd --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,52 @@ +# CLAUDE.md + +Guidance for AI coding agents working in this repository. Human contributors: see CONTRIBUTING.md. + +## Project + +Hash Tool — Avalonia 12 / .NET 10 desktop app (`src/HashTool.App`, executable `CheckHash`) plus the `hashtool` CLI +(`src/HashTool.Cli`, NativeAOT), both built on `src/HashTool.Core`. Maintainer: poli0981 (GitHub). The maintainer writes +in Vietnamese; reply in Vietnamese unless asked otherwise. Code, comments, commits and docs are English. + +Read docs/ARCHITECTURE.md before larger changes and docs/RELEASING.md before touching packaging or the Release workflow. + +## Commands + +```text +dotnet build HashTool.slnx -warnaserror # CI treats warnings (incl. NuGet audit, analyzers) as errors +dotnet test --solution HashTool.slnx # Microsoft.Testing.Platform (global.json); not VSTest +dotnet format HashTool.slnx --verify-no-changes # CI-enforced +python -I eng/loc.py check # translations: keys, placeholders, whitespace, wiring +dotnet src/HashTool.App/bin/Debug/net10.0/CheckHash.dll --smoke-test # headless end-to-end check +``` + +Run the app or smoke test with `HASHTOOL_DATA_DIR` pointing at a scratch folder so the user's real settings +(`%LOCALAPPDATA%\HashTool`) are never touched. Chain build/test/format/commit with `&&`, not `;`. + +## Rules that are easy to break + +- **Velopack/update invariants** (docs/RELEASING.md): pack id `HashTool`, channels `win`/`osx` (+ `osx-x64`, `linux`), + main exe `CheckHash(.exe)`, macOS bundle id `com.HashTool.HashTool` (build/macos/Info.plist), no `--packTitle` on + Windows, tags without `v`, settings path. Changing any of these strands 1.x users. +- Never run a built `HashTool-*-Setup.exe`/`.pkg` on the maintainer's machine; test updates with portable builds in a + scratch folder (the Release workflow's upgrade gate does this in CI). +- Every UI string goes through `Localization[Key]` / `L["Key"]` and must exist in all 67 resx files; add keys with + `eng/loc.py set` (JSON `{culture: {key: value}}`, `"neutral"` = English). App.Tests fail on missing, unused or + mismatched keys. Keep "Hash Tool" untranslated inside sentences. +- Core is UI-free and AOT/trim compatible: no reflection-based JSON (use the source-generated contexts), keep + `ConfigureAwait(false)` (Meziantou MA0004 is on for Core and CLI, off for App/tests). +- Culture: use invariant formatting for logs, file names and machine-readable output; the UI uses the selected culture. +- CRC32 is big-endian (standard); `HashMatcher` accepts the 1.1 little-endian form as `LegacyByteOrderMatch`. +- Checksum entries must go through `ChecksumEntry.ResolvePath` (rejects UNC/device paths). +- GitHub Actions: pin every action to a full commit SHA with a version comment, `persist-credentials: false`, per-job + minimal `permissions`, no `${{ }}` inside `run:` (pass through `env:`). zizmor and actionlint run in the Security + workflow; `ci-ok` is the single required check. +- Don't embed C# or regex text containing backslashes in Python/bash heredocs — the escapes get mangled. Edit such + files with the editor tools. + +## Workflows + +- `ci.yml` — build/test on Windows, macOS, Linux; coverage gate (Core ≥ 80%); smoke test; format; translation check. +- `security.yml` — vulnerable packages, licences (eng/allowed-licenses.json), gitleaks, actionlint, zizmor. +- `release.yml` — manual (`workflow_dispatch`, version + publish) with an upgrade gate from 1.1.3; dry run on PRs that + touch release files. Discord notifications use the maintainer's `poli0981/.github` reusable workflows, pinned by SHA. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dcd84c4..5cec84f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,65 +1,60 @@ # Contributing to HashTool Thanks for taking an interest in HashTool. Your contributions help make it better for everyone. -Whether you're reporting a bug, suggesting a new feature, or submitting code, every contribution is appreciated. +Whether you're reporting a bug, suggesting a new feature, fixing a translation or submitting code, every contribution is appreciated. This project is still small and solo-maintained, so keep it simple and direct — I read everything. -## Reporting Bugs or Requesting Features +## Reporting bugs or requesting features -**Super easy way**: -- Check the **pinned issues** first (there'll be a "Bug Reports" and "Feature Requests" thread). -- Just **comment** on the relevant thread, or create a new issue if it doesn't fit. +Open an [issue](https://github.com/poli0981/HashTool/issues/new/choose) and pick **Bug report** or **Feature request** — the form asks for what's needed (version, OS, steps, logs). +Questions and ideas are welcome in [Discussions](https://github.com/poli0981/HashTool/discussions). -### Issue Template (keep it short!) -Please use this format in your issue title and body: +Security problems: please **don't** open a public issue — see [SECURITY.md](SECURITY.md). -**Title** -`Bug: ` or `Feature: ` -(e.g., `Bug: App crashes on large files` or `Feature: Add CRC32 algorithm`) +## Building and testing -**Body** -1. **Description** - Clearly explain the bug or the feature you'd like. - Example for bug: "NullReferenceException when selecting >100 files on Windows 11". +You need the [.NET 10 SDK](https://dotnet.microsoft.com/download) (10.0.400 or newer) — `global.json` picks it up. Python 3 is only needed for the translation tool. -2. **Steps to Reproduce** (for bugs) or **Expected Behavior** (for features) - Be specific if possible. +```text +dotnet build HashTool.slnx -warnaserror # what CI runs; warnings are errors +dotnet test --solution HashTool.slnx # Core, CLI and headless UI tests +dotnet format HashTool.slnx --verify-no-changes # formatting, enforced by CI +dotnet run --project src/HashTool.App # start the app +dotnet src/HashTool.App/bin/Debug/net10.0/CheckHash.dll --smoke-test # headless self-check +``` -3. **Screenshots** (optional but super helpful) - Drag & drop images directly into the issue. +Set `HASHTOOL_DATA_DIR` to a scratch folder when you run the app during development, so it does not touch your real settings. -4. **Pseudo-code / Suggestion** (optional) - If you have an idea how to fix/implement it, share it! +How the code is organised: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). -5. **Priority** (optional) - Your opinion: "Critical", "Nice to have", "Low priority", etc. +## Submitting code (pull requests) -That's it! No strict rules — just be clear and concise. +1. Fork the repo and create a branch: `fix/crash-on-large-files` or `feature/new-algorithm`. +2. Keep the change focused; follow the existing style (the analyzers and `.editorconfig` help). +3. Add or update tests — hashing and checksum logic belongs in `HashTool.Core` with tests in `tests/HashTool.Core.Tests`. +4. Add a line under `## [Unreleased]` in [CHANGELOG.md](CHANGELOG.md) for anything users will notice. +5. Open the pull request and link the issue. CI builds and tests on Windows, macOS and Linux, and scans dependencies, licences, secrets and workflows; everything must be green before merging. -## Submitting Code (Pull Requests) +Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) (`fix(core): …`, `feat(app): …`, `docs: …`). -Want to fix something yourself? Awesome. +## Translations -1. Fork the repo. -2. Clone your fork. -3. Create a branch: `git checkout -b fix/crash-on-large-files` or `feature/new-algorithm`. -4. Make your changes (follow existing code style — clean, readable C#). -5. Test thoroughly (especially on both Windows & macOS if possible). -6. Push and open a Pull Request. - - Link the related issue in the PR description. - - Keep PRs focused on one thing when possible. +All UI text lives in `src/HashTool.App/Lang/Resources.*.resx` (English is `Resources.resx`; 66 other languages). Use the helper instead of editing XML by hand: -I'll review as fast as I can. If it's good, it gets merged and you get credit. +```text +python -I eng/loc.py check # same keys and placeholders everywhere, no stray whitespace +python -I eng/loc.py untranslated vi-vn # strings that are still English +python -I eng/loc.py export vi-vn # a language as JSON +python -I eng/loc.py set changes.json # {"vi-vn": {"Key": "text"}, "neutral": {...}} +``` -## Code Style & Guidelines -- Keep it simple and consistent with existing code. -- Add comments for tricky parts. -- No strict linter yet — just make it readable. +New text needs a key in **every** file — the localization tests fail otherwise. Keep placeholders such as `{0}` exactly, and keep the product name "Hash Tool". Corrections from native speakers are very welcome; most translations were made with AI assistance. ## Code of Conduct + Please be respectful — see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for details. Thanks again for helping make HashTool better. -© 2026 poli0981. All rights reserved. \ No newline at end of file +© 2026 poli0981. All rights reserved. diff --git a/README.md b/README.md index a5d89da..53a5ad2 100644 --- a/README.md +++ b/README.md @@ -1,120 +1,130 @@ # HashTool 🛠️ -[![Version](https://img.shields.io/badge/version-1.1.3-blue.svg)](https://github.com/poli0981/HashTool/releases/tag/1.1.3) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) +[![Release](https://img.shields.io/github/v/release/poli0981/HashTool?sort=semver)](https://github.com/poli0981/HashTool/releases/latest) +[![CI](https://github.com/poli0981/HashTool/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/HashTool/actions/workflows/ci.yml) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/poli0981/HashTool/badge)](https://scorecard.dev/viewer/?uri=github.com/poli0981/HashTool) +[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Downloads](https://img.shields.io/github/downloads/poli0981/HashTool/total.svg)](https://github.com/poli0981/HashTool/releases) -**A user-friendly, cross-platform desktop app (Windows & macOS) for generating, verifying, and managing file hashes — no terminal commands required.** +**A friendly desktop app for Windows, macOS and Linux that generates and verifies file hashes and checksum files — no terminal commands required.** A small `hashtool` command-line tool comes along for when you do want the terminal. Built with C# on .NET 10 and Avalonia UI. ## Motivation -Why open a terminal and type cryptic commands just to hash a file? +Why open a terminal and type cryptic commands just to hash a file? HashTool was born out of pure laziness — a simple, intuitive GUI to do the job without the hassle. ## Screenshots -![Generate Hash](docs/images/generate.png) -*Generate Hash – batch processing with multiple export options* +![Generate Hash](docs/images/generate.png) +*Generate Hash – batch processing with several export options* -![Verify Hash](docs/images/verify.png) -*Verify Hash – smart detection and batch verification* +![Verify Hash](docs/images/verify.png) +*Verify Hash – checksum files, sidecar detection and batch verification* -![Settings](docs/images/setting_screenshot_1.png) -*Settings – themes, localization, performance tweaks* +![Settings](docs/images/setting_screenshot_1.png) +*Settings – themes, languages, performance and limits* -![Settings 2](docs/images/setting_screenshot_2.png) -*Settings – Windows Admin Mode, Hash Masking, Developer Mode, etc.* +![Dark Mode](docs/images/dark.png) *Dark mode – because who doesn't love dark mode?* -![About](docs/images/about.png) *About – version info and links* - -![Update](docs/images/update.png) -*Update – check for latest version* - -![Dev Mode](docs/images/dev.png) -*Developer Mode – extra tools for power users* - -![Dark Mode](docs/images/dark.png) *Dark Mode – because who doesn't love dark mode?* +More: [About](docs/images/about.png) · [Update](docs/images/update.png) · [Developer console](docs/images/dev.png) · [Settings 2](docs/images/setting_screenshot_2.png) ## Features ### Generate Hash -- **Batch processing**: Compute hashes for multiple files simultaneously using parallel processing. -- **Export options**: - - Save individual hash files (e.g., `filename.ext.sha256`). - - Copy hash results to clipboard. - - Bundle all hashes into a single ZIP archive. +- Drop files or whole folders (or use Add Files / Add Folder); folders are scanned in the background. +- Several files are hashed at once; each file is read only once, whatever the algorithm. +- Export all results as **one checksum file** — GNU (`sha256sum` style), BSD tagged, SFV, JSON or CSV — with paths relative to where you save it. +- Save a single hash next to its file (`photo.jpg.sha256`), copy hashes, or bundle them into a ZIP with a `CHECKSUMS.txt` manifest. ### Verify Hash -- **Batch verification**: Check multiple files against their expected hashes. -- **Smart detection**: - - Automatically finds accompanying hash files (e.g., checks `image.png.sha256` when verifying `image.png`). - - Directly load hash files (`.md5`, `.sha1`, etc.) to verify the source file. +- Drop or open a checksum file (`SHA256SUMS`, `*.sha256`, `*.md5`, `*.sfv`, BSD tagged lists, xxhsum output…) and every file it lists is loaded and checked. +- Drop a file alone and HashTool finds its sidecar (`image.iso.sha256`, `image.iso.md5`…) automatically. +- Paste an expected hash, or drop a hash file onto a row; the algorithm is guessed from the file name or the hash length when needed. +- Clear results: **VALID**, **MISMATCH**, missing files, access denied, files in use, time-outs. -### Settings & Customization +### Everything else -- **Appearance**: - - Light, Dark, or System theme. - - Custom UI scaling and font size. -- **Localization**: 30+ languages with auto-detection based on OS. Manually override and set as default. -- **Performance**: Configure max file size limits and per-file timeout. -- **Windows Admin Mode**: Toggle elevated privileges when needed. -- **Extra goodies**: Hash masking (hide sensitive parts), Developer Mode, Settings Lock, UI Reset. +- **11 algorithms**: MD5, SHA-1, SHA-256, SHA-384, SHA-512, BLAKE3, xxHash32, xxHash64, XXH3, XXH128, CRC32 (MD5 and SHA-1 are fine for detecting corruption, not for security). +- **67 languages** with automatic detection and right-to-left layouts. +- Light/dark/system, eight theme styles (including colour-blind friendly and high contrast), fonts and UI scale. +- Hash masking, settings lock, file size/count limits, per-file time-out, hard-drive mode. +- **System integration**: Explorer right-click menu on Windows (optional), "Open With" on macOS, `--create`/`--verify` command-line arguments. +- Automatic update check (at most once a day, can be turned off) with release notes; updates install in place. +- Developer console with live logs. -> **Note**: Hashing speed depends on your drive (SSD vs HDD) and system load. - -### Update - -- **Update**: Check for updates on "Update" page. - -### Supported Algorithms - -- MD5 -- SHA1 -- SHA256 -- SHA384 -- SHA512 -- BLAKE3 -- CRC32 -- XXHash64 -- XXHash128 -- XXHash32 -- XXHash3 +> Hashing speed depends mostly on your drive (SSD vs HDD) and system load. Turn on *Optimize for hard drives* in Settings for spinning disks and network shares. ## Installation -### Windows +Download from the [latest release](https://github.com/poli0981/HashTool/releases/latest): -- **Installer**: Download `HashTool-win-setup.exe` from GitHub Releases → run → done in seconds. -- **Portable**: Download the ZIP → extract → run `Hash Tool.exe`. +| Platform | Installer | Portable | +|---|---|---| +| Windows 10/11 (x64) | `HashTool-win-Setup.exe` | `HashTool-win-Portable.zip` — extract, run `HashTool.exe` | +| macOS, Apple silicon | `HashTool-osx-Setup.pkg` | `HashTool-osx-Portable.zip` | +| macOS, Intel | `HashTool-osx-x64-Setup.pkg` | `HashTool-osx-x64-Portable.zip` | +| Linux (x64) | — | `HashTool.AppImage` | -### macOS +**macOS:** the app is not signed yet (no Apple Developer account 😅), so Gatekeeper may complain. Right-click the app → **Open**, or allow it in *System Settings → Privacy & Security*. -*(May trigger Gatekeeper warnings — unsigned app because no Apple Developer account yet 😅)* +**Linux:** make the AppImage executable (`chmod +x HashTool.AppImage`) and run it. AppImages need FUSE 2 (`sudo apt install libfuse2` on Ubuntu/Debian). -- **Installer**: Download `.pkg` → Continue → Install → Done. -- **Portable**: Download `.zip` → extract → open `.app` (right-click → Open if Gatekeeper complains). +Installed and portable copies update themselves from the *Update* page. -## Usage +### Command-line tool -The UI is designed to be dead simple — drag & drop files, pick your algorithm, hit Go. -Detailed guides and advanced tips will be added to the [Wiki](https://github.com/poli0981/HashTool/wiki) soon. +`hashtool--` archives contain a single native executable — no .NET install needed. + +```text +hashtool hash photo.jpg # sha256sum-style line +hashtool hash -r ./dist -o ./dist/SHA256SUMS # every file in a folder, paths relative to the output +hashtool hash -a sha256,blake3 big.iso # several algorithms, one read (BSD tagged output) +hashtool verify SHA256SUMS # like sha256sum -c: exit 0 = all OK, 1 = mismatch/missing +hashtool check big.iso -e 4f2c… # one file against one hash (algorithm guessed from length) +hashtool algorithms +``` + +See [docs/USAGE.md](docs/USAGE.md) for every option and the app's command-line arguments. + +## Verifying downloads + +Every release includes `SHA256SUMS` and GitHub build provenance attestations: + +```text +sha256sum -c SHA256SUMS --ignore-missing +gh attestation verify HashTool-win-Setup.exe --repo poli0981/HashTool +``` + +## Building from source + +Requires the [.NET 10 SDK](https://dotnet.microsoft.com/download) (10.0.400 or newer). + +```text +dotnet build HashTool.slnx +dotnet test --solution HashTool.slnx +dotnet run --project src/HashTool.App +dotnet run --project src/HashTool.Cli -- hash README.md +``` + +How the code is organised: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). How releases are made: [docs/RELEASING.md](docs/RELEASING.md). ## Contributing -Want to help? Check out [CONTRIBUTING.md](CONTRIBUTING.md) for bug reports, feature requests, or code contributions. +Bug reports, translations and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). ## Legal Stuff -- [LICENSE (MIT)](LICENSE) -- [EULA](docs/EULA.md) -- [Disclaimer](/docs/DISCLAIMER.md) -- [Terms of Service](/docs/ToS.md) -- [Privacy Policy](/docs/PrivacyPolicy.md) -- [Security Policy](SECURITY.md) -- [Code of Conduct](CODE_OF_CONDUCT.md) +- [LICENSE (MIT)](LICENSE) +- [EULA](docs/EULA.md) +- [Disclaimer](docs/DISCLAIMER.md) +- [Terms of Service](docs/ToS.md) +- [Privacy Policy](docs/PrivacyPolicy.md) +- [Security Policy](SECURITY.md) +- [Code of Conduct](CODE_OF_CONDUCT.md) ## Acknowledgements @@ -124,4 +134,4 @@ Big thanks to the open-source community and AI assistants — full credits in [A Made with ❤️ (and a lot of coffee) by poli0981 -*© 2026 poli0981. All rights reserved.* \ No newline at end of file +*© 2026 poli0981. Released under the MIT License.* diff --git a/SECURITY.md b/SECURITY.md index e051374..9f06af4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,17 +1,21 @@ # Security Policy for HashTool -**Version 1.1.3** -**Last updated: February 2026** +**Last updated: October 2026** -HashTool is a free, open-source desktop application built with C# (.NET 10) and Avalonia UI. It runs **100% offline** (except optional update check via GitHub), processes files locally, and has no network server components. +HashTool is a free, open-source desktop application built with C# (.NET 10) and Avalonia UI. It processes files locally, has no server components, and only goes online to check GitHub for updates. ### Supported Versions -Currently, security updates are provided for the latest release only: +Security fixes are released for the latest minor version only. Installed and portable copies update themselves, so please stay on the newest release. | Version | Supported | | ------- | ------------------ | -| 1.0.x | :white_check_mark: | -| < 1.0 | :x: | +| 1.2.x | :white_check_mark: | +| < 1.2 | :x: | + +### How releases are protected +- Releases are built, tested and published by GitHub Actions from the `main` branch; every release includes `SHA256SUMS`, CycloneDX SBOMs and [build provenance attestations](https://docs.github.com/actions/security-for-github-actions/using-artifact-attestations) (`gh attestation verify --repo poli0981/HashTool`). +- Every pull request is checked for vulnerable NuGet packages, licences, leaked secrets and unsafe workflow patterns, in addition to CodeQL and OpenSSF Scorecard. +- The apps are not code-signed yet, so Windows SmartScreen and macOS Gatekeeper may warn when they are first opened. ### Reporting a Vulnerability If you discover a potential security vulnerability, please report it responsibly: diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..9b4408a --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,71 @@ +# Architecture + +HashTool is a .NET 10 solution with three shipped programs sharing one core library. + +``` +src/HashTool.Core hashing, checksum files, folder walking, settings (no UI; trim/AOT compatible) +src/HashTool.App Avalonia 12 desktop app (CheckHash.exe) — views, view models, services +src/HashTool.Cli `hashtool` command-line tool (System.CommandLine, NativeAOT) +tests/ Core.Tests, Cli.Tests, App.Tests (Avalonia headless); Compat/LegacyClient (release gate) +bench/ BenchmarkDotNet benchmarks (run by hand) +eng/ scripts used by CI and releases (translations, coverage, release notes, package checks) +build/ packaging inputs (macOS Info.plist, Linux icon) +``` + +Shared build settings: `Directory.Build.props` (version, nullable, analyzers, NuGet audit), `Directory.Packages.props` +(central package versions with transitive pinning), `global.json` (SDK and the Microsoft.Testing.Platform runner), +`dotnet-tools.json` (vpk, nuget-license, CycloneDX). + +## HashTool.Core + +| Area | Types | Notes | +|---|---|---| +| Hashing | `HashEngine`, `HashType`, `HashAlgorithms`, `HashResult`, `HashMatcher` | One read per file for any number of algorithms: double-buffered reads (1 MiB, 4 MiB above 1 GiB), each block fed to every algorithm in parallel; BLAKE3 uses its multi-threaded update for large blocks. CRC32 is big-endian (as 7-Zip/SFV); `HashMatcher` still accepts the reversed order Hash Tool 1.1 wrote. | +| Checksum files | `ChecksumParser`, `ChecksumWriter`, `ChecksumDocument`, `ChecksumFileNames` | Reads GNU (`hash name`, `*name`, escaped names), BSD tagged, SFV, xxhsum `XXH3_` and bare sidecar hashes; writes GNU/BSD/SFV/JSON/CSV. The algorithm comes from the line, then the file name, then the user's choice, then the hash length. Paths may not point to UNC or device locations; CSV output neutralises formulas. | +| Files | `FileEnumerator`, `FileErrors` | Walks folders without following symbolic links or junctions, skips unreadable folders, optionally hidden files. | +| Processing | `BatchProcessor`, `HashJob`, `IHashJobObserver` | Small files in parallel (default `min(cores, 4)`), files ≥ 1 GiB in a separate lane, one at a time in HDD mode; per-file time-out; every item is reported exactly once. | +| Configuration | `AppSettings`, `SettingsStore` | `config.json` with a schema version; atomic writes (temp file + move), values clamped on load, a corrupt file is backed up as `config.json.bak-