diff --git a/ACCESSIBILITY.md b/ACCESSIBILITY.md index 4c76ae9..48f345f 100644 --- a/ACCESSIBILITY.md +++ b/ACCESSIBILITY.md @@ -27,7 +27,8 @@ Priorities, in this order: **Keyboard.** Tab and Shift+Tab move between controls, the arrow keys move between rows of a file list, and Enter or Space activates the focused control. In a file row, Tab moves through that row's controls (algorithm, hash, copy, save, run, clear, remove) and then leaves the list. When a run starts, focus moves from **COMPUTE ALL** / **VERIFY ALL** to -**Cancel**, and back when it ends. +**Cancel**, and back when it ends. On **Hash Text**, Enter starts a new line in the text box and Tab moves on to the +options and to each algorithm's hash and copy button. | Keys | Action | |---|---| diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f168c1..0affc4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added +- **Hash Text** page: type or paste text and see its hash in every algorithm, updated as you type, with a copy button for each. Choose UTF-8 or UTF-16 and LF or CRLF line breaks; nothing is added at the end, so the SHA-256 matches `printf '%s' 'text' | sha256sum`. Suggested in [Discussions #23](https://github.com/poli0981/HashTool/discussions/23). This is Hash Tool's last new feature: from 1.3.0 on, the project is in maintenance mode. +- `hashtool hash -` hashes standard input, as `sha256sum -` does. + ### Security - Updated to the .NET 10.0.15 runtime, which the self-contained downloads include. It fixes denial of service and elevation of privilege vulnerabilities in .NET (CVE-2026-109475, CVE-2026-105544, CVE-2026-114155, CVE-2026-118747). diff --git a/README.md b/README.md index fc05dfa..ca24583 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,12 @@ More: [About](docs/images/about.png) · [Update](docs/images/update.png) · [Dev - 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. +### Hash Text + +- Type or paste text and see its hash in every algorithm, updated as you type, with a copy button for each. +- Choose UTF-8 or UTF-16 and LF or CRLF line breaks; nothing is added at the end, so the result matches + `printf '%s' 'text' | sha256sum`. + ### Everything else - **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). @@ -89,6 +95,7 @@ hashtool hash -r ./dist -o ./dist/SHA256SUMS # every file in a folder, paths 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) +printf '%s' 'hello' | hashtool hash - # text from standard input hashtool algorithms ``` diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 806c46b..858f095 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -21,7 +21,7 @@ them up to date). | 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. | +| Hashing | `HashEngine`, `HashType`, `HashAlgorithms`, `HashResult`, `HashMatcher`, `TextHashing` | 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. `TextHashing` turns text into the bytes the Hash Text page and `hashtool hash -` hash: UTF-8/UTF-16 without a byte order mark, LF or CRLF line breaks, nothing appended. | | 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. | @@ -34,6 +34,7 @@ them up to date). - **Views and view models** — compiled bindings everywhere; `App.axaml` maps each view model to its view. `FileListViewModelBase` holds what Generate and Verify share: importing (background enumeration, batches of 1000), filtering, running a `BatchProcessor` with UI updates pumped every 100 ms, and the summary dialog. + `TextHashViewModel` (Hash Text) hashes text in memory with every algorithm, shortly after each change. - **Localization** — `LocalizationService` reads the satellite resources, detects the system language, sets the culture (including `DefaultThreadCurrentCulture`, so async work keeps it) and right-to-left flow. Views bind `Localization[Key]`; view models swap their `LocalizationProxy` when the language changes, which refreshes every @@ -48,7 +49,7 @@ them up to date). ## HashTool.Cli -`hashtool hash | verify | check | algorithms`, built on Core. Exit codes follow `sha256sum`: 0 success, 1 failed or +`hashtool hash | verify | check | algorithms`, built on Core; `hash -` reads standard input. Exit codes follow `sha256sum`: 0 success, 1 failed or mismatched file, 2 usage error or unreadable checksum file. Published per platform as a single NativeAOT executable. ## Tests diff --git a/docs/USAGE.md b/docs/USAGE.md index cb49551..4311f12 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -31,6 +31,17 @@ Results: **VALID**, **MISMATCH!**, *Not a valid … hash* (wrong length or chara On Windows, files you cannot read can be retried with **Restart as Administrator** (offered after a run, and in Settings). While elevated, Windows blocks drag and drop from Explorer. +### Hash Text + +Type or paste text on the **Hash Text** page to see its hash in every algorithm, updated as you type, with a copy +button for each. The hash is of exactly the text in the box: + +- **Encoding** — UTF-8 (the usual choice), UTF-16 LE or UTF-16 BE, without a byte order mark. +- **Line breaks** — LF (Linux, macOS, `printf` output) or CRLF (Windows text files). Every line break in the text is + written that way, whatever Enter inserts. +- Nothing is added at the end: `printf '%s' 'text' | sha256sum` gives the same SHA-256, while `echo text | sha256sum` + also hashes the line break that `echo` adds. + ### Keyboard | Keys | Action | @@ -42,7 +53,7 @@ Settings). While elevated, Windows blocks drag and drop from Explorer. | Esc | Cancel the run; close a dialog | | Delete | Remove the selected row | | Up/Down | Move between rows | -| Tab / Shift+Tab | Next / previous control; in a row, its algorithm, hash and buttons, then out of the list | +| Tab / Shift+Tab | Next / previous control; in a row, its algorithm, hash and buttons, then out of the list; on Hash Text, out of the text box (Enter starts a new line) | | Enter, Space | Press the focused button; in a dialog, Enter presses the highlighted button | Everything you can drop has a button too (**Add Files…**, **Add Folder…**, **Open Checksum File…**, **Browse** on a @@ -89,6 +100,7 @@ hashtool algorithms | Option | Meaning | |---|---| +| `-` (as a path) | `hash`: read standard input instead of a file, once per command: `printf '%s' 'text' \| hashtool hash -`. | | `-a, --algorithm` | `sha256` (default), `sha1`, `md5`, `sha384`, `sha512`, `blake3`, `xxhash32`, `xxhash64`, `xxhash3`, `xxhash128`, `crc32`. Repeat or separate with commas: `-a sha256,blake3`. | | `-r, --recursive` | Hash every file inside the given folders (links are not followed). | | `-f, --format` | Output format. Default: `gnu` for one algorithm, `bsd` for several. | @@ -107,4 +119,5 @@ Examples: hashtool hash -r . -o SHA256SUMS && hashtool verify SHA256SUMS hashtool hash -a crc32 -f sfv *.rar > files.sfv hashtool check ubuntu.iso -e 3b1c… # algorithm guessed from the hash length +printf '%s' 'hello' | hashtool hash -a sha256,md5 - # text from standard input ``` diff --git a/src/HashTool.App/App.axaml b/src/HashTool.App/App.axaml index c4a6200..b50e07b 100644 --- a/src/HashTool.App/App.axaml +++ b/src/HashTool.App/App.axaml @@ -15,6 +15,9 @@ + + + diff --git a/src/HashTool.App/AppHost.cs b/src/HashTool.App/AppHost.cs index 40d9a40..fa8d041 100644 --- a/src/HashTool.App/AppHost.cs +++ b/src/HashTool.App/AppHost.cs @@ -51,6 +51,7 @@ public static class AppHost services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/src/HashTool.App/Converters/LabelConverters.cs b/src/HashTool.App/Converters/LabelConverters.cs index d26c907..49aa1c4 100644 --- a/src/HashTool.App/Converters/LabelConverters.cs +++ b/src/HashTool.App/Converters/LabelConverters.cs @@ -38,6 +38,7 @@ public sealed class EnumLabelConverter : IMultiValueConverter _ => "Size_All" }], AppThemeStyle style => localization[$"Theme_{style}"], + LineBreak lineBreak => localization[lineBreak == LineBreak.CrLf ? "Lbl_LineBreaksCrLf" : "Lbl_LineBreaksLf"], ILabeled labeled => localization[labeled.LabelKey], var other => other.ToString() }; diff --git a/src/HashTool.App/Infrastructure/SmokeTest.cs b/src/HashTool.App/Infrastructure/SmokeTest.cs index 7dd368a..673ad54 100644 --- a/src/HashTool.App/Infrastructure/SmokeTest.cs +++ b/src/HashTool.App/Infrastructure/SmokeTest.cs @@ -73,12 +73,19 @@ public static class SmokeTest var main = AppHost.Get(); var window = new MainWindow { DataContext = main }; window.Show(); - foreach (var page in new[] { "Check", "Settings", "Update", "About", "Developer", "Create" }) + foreach (var page in new[] { "Check", "Text", "Settings", "Update", "About", "Developer", "Create" }) { main.NavigateCommand.Execute(page); Dispatcher.UIThread.RunJobs(); } + // Hash a text. + main.Text.Text = "123456789"; + await main.Text.Pending; + var textHash = main.Text.Results.Single(r => r.Algorithm == Core.Hashing.HashType.SHA256).Hash; + if (!string.Equals(textHash, Sha256Of123456789, StringComparison.OrdinalIgnoreCase)) + report.Errors.Add($"Text: unexpected hash {textHash}"); + // Every language has its satellite resources and core strings. var localization = AppHost.Get(); foreach (var language in localization.Languages) diff --git a/src/HashTool.App/Lang/Resources.ar.resx b/src/HashTool.App/Lang/Resources.ar.resx index 12323ef..bc1de45 100644 --- a/src/HashTool.App/Lang/Resources.ar.resx +++ b/src/HashTool.App/Lang/Resources.ar.resx @@ -749,4 +749,37 @@ قيمة الهاش + + هاش النص + + + هاش النص + + + اكتب نصاً أو الصقه لعرض الهاش الخاص به بكل خوارزمية. يُحسب الهاش من النص كما هو تماماً، بالترميز وفواصل الأسطر المحددة أدناه، ودون إضافة فاصل أسطر في نهايته. + + + النص المراد حساب الهاش له + + + الترميز + + + فواصل الأسطر + + + LF (Linux، macOS) + + + CRLF (Windows) + + + الحجم: {0} + + + هاش {0} + + + نسخ هاش {0} + diff --git a/src/HashTool.App/Lang/Resources.bg-bg.resx b/src/HashTool.App/Lang/Resources.bg-bg.resx index a14e928..2d05842 100644 --- a/src/HashTool.App/Lang/Resources.bg-bg.resx +++ b/src/HashTool.App/Lang/Resources.bg-bg.resx @@ -749,4 +749,37 @@ Стойност на хеша + + Хеширане на текст + + + Хеширане на текст + + + Въведете или поставете текст, за да видите хеша му за всеки алгоритъм. Текстът се хешира точно такъв, какъвто е, с кодирането и знаците за нов ред, избрани по-долу, без добавяне на нов ред в края. + + + Текст за хеширане + + + Кодиране + + + Знаци за нов ред + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Размер: {0} + + + Хеш {0} + + + Копирай хеш {0} + diff --git a/src/HashTool.App/Lang/Resources.bn-bd.resx b/src/HashTool.App/Lang/Resources.bn-bd.resx index bd3251a..7578c5b 100644 --- a/src/HashTool.App/Lang/Resources.bn-bd.resx +++ b/src/HashTool.App/Lang/Resources.bn-bd.resx @@ -749,4 +749,37 @@ হ্যাশ মান + + টেক্সট হ্যাশ করুন + + + টেক্সট হ্যাশ করুন + + + প্রতিটি অ্যালগরিদমে এর হ্যাশ দেখতে টেক্সট টাইপ বা পেস্ট করুন। টেক্সটটি নিচে বেছে নেওয়া এনকোডিং ও লাইন ব্রেকসহ হুবহু যেমন আছে তেমনভাবে হ্যাশ করা হয়, এবং শেষে কোনো লাইন ব্রেক যোগ করা হয় না। + + + হ্যাশ করার টেক্সট + + + এনকোডিং + + + লাইন ব্রেক + + + LF (Linux, macOS) + + + CRLF (Windows) + + + সাইজ: {0} + + + {0} হ্যাশ + + + {0} হ্যাশ কপি করুন + diff --git a/src/HashTool.App/Lang/Resources.bs-latn-ba.resx b/src/HashTool.App/Lang/Resources.bs-latn-ba.resx index 1f57436..cfe1417 100644 --- a/src/HashTool.App/Lang/Resources.bs-latn-ba.resx +++ b/src/HashTool.App/Lang/Resources.bs-latn-ba.resx @@ -749,4 +749,37 @@ Vrijednost heša + + Heš teksta + + + Heš teksta + + + Upišite ili zalijepite tekst da biste vidjeli njegov heš za svaki algoritam. Heš se računa iz teksta tačno onakvog kakav jeste, u kodiranju i s prelomima redova odabranim ispod, bez dodavanja preloma reda na kraju. + + + Tekst za izračun heša + + + Kodiranje + + + Prelomi redova + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Veličina: {0} + + + Heš {0} + + + Kopiraj heš {0} + diff --git a/src/HashTool.App/Lang/Resources.cs-cz.resx b/src/HashTool.App/Lang/Resources.cs-cz.resx index 318e8ea..d20e6e5 100644 --- a/src/HashTool.App/Lang/Resources.cs-cz.resx +++ b/src/HashTool.App/Lang/Resources.cs-cz.resx @@ -749,4 +749,37 @@ Hodnota hashe + + Hashovat text + + + Hashovat text + + + Napište nebo vložte text a zobrazí se jeho hash pro každý algoritmus. Text se hashuje přesně tak, jak je, v kódování a s konci řádků zvolenými níže, bez přidání nového řádku na konci. + + + Text k hashování + + + Kódování + + + Konce řádků + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Velikost: {0} + + + Hash {0} + + + Kopírovat hash {0} + diff --git a/src/HashTool.App/Lang/Resources.da-dk.resx b/src/HashTool.App/Lang/Resources.da-dk.resx index c1d82e6..4e10491 100644 --- a/src/HashTool.App/Lang/Resources.da-dk.resx +++ b/src/HashTool.App/Lang/Resources.da-dk.resx @@ -749,4 +749,37 @@ Hashværdi + + Hash tekst + + + Hash tekst + + + Skriv eller indsæt tekst for at se dens hash med hver algoritme. Teksten hashes præcis, som den er, med den kodning og de linjeskift, der er valgt nedenfor, og der tilføjes intet linjeskift til sidst. + + + Tekst, der skal hashes + + + Kodning + + + Linjeskift + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Størrelse: {0} + + + {0}-hash + + + Kopier {0}-hash + diff --git a/src/HashTool.App/Lang/Resources.de-at.resx b/src/HashTool.App/Lang/Resources.de-at.resx index 1c0e60a..30367a6 100644 --- a/src/HashTool.App/Lang/Resources.de-at.resx +++ b/src/HashTool.App/Lang/Resources.de-at.resx @@ -749,4 +749,37 @@ Hashwert + + Text hashen + + + Text hashen + + + Text eingeben oder einfügen, um seinen Hash für jeden Algorithmus zu sehen. Der Text wird unverändert gehasht, mit Codierung und Zeilenumbrüchen wie unten gewählt, und am Ende wird kein Zeilenumbruch angefügt. + + + Zu hashender Text + + + Codierung + + + Zeilenumbrüche + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Größe: {0} + + + {0}-Hash + + + {0}-Hash kopieren + diff --git a/src/HashTool.App/Lang/Resources.de-ch.resx b/src/HashTool.App/Lang/Resources.de-ch.resx index 56a7748..0d0dc94 100644 --- a/src/HashTool.App/Lang/Resources.de-ch.resx +++ b/src/HashTool.App/Lang/Resources.de-ch.resx @@ -749,4 +749,37 @@ Hashwert + + Text hashen + + + Text hashen + + + Text eingeben oder einfügen, um seinen Hash für jeden Algorithmus zu sehen. Der Text wird unverändert gehasht, mit Codierung und Zeilenumbrüchen wie unten gewählt, und am Ende wird kein Zeilenumbruch angefügt. + + + Zu hashender Text + + + Codierung + + + Zeilenumbrüche + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Grösse: {0} + + + {0}-Hash + + + {0}-Hash kopieren + diff --git a/src/HashTool.App/Lang/Resources.de-de.resx b/src/HashTool.App/Lang/Resources.de-de.resx index 1c0e60a..30367a6 100644 --- a/src/HashTool.App/Lang/Resources.de-de.resx +++ b/src/HashTool.App/Lang/Resources.de-de.resx @@ -749,4 +749,37 @@ Hashwert + + Text hashen + + + Text hashen + + + Text eingeben oder einfügen, um seinen Hash für jeden Algorithmus zu sehen. Der Text wird unverändert gehasht, mit Codierung und Zeilenumbrüchen wie unten gewählt, und am Ende wird kein Zeilenumbruch angefügt. + + + Zu hashender Text + + + Codierung + + + Zeilenumbrüche + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Größe: {0} + + + {0}-Hash + + + {0}-Hash kopieren + diff --git a/src/HashTool.App/Lang/Resources.dv-mv.resx b/src/HashTool.App/Lang/Resources.dv-mv.resx index c017f2a..4f39cde 100644 --- a/src/HashTool.App/Lang/Resources.dv-mv.resx +++ b/src/HashTool.App/Lang/Resources.dv-mv.resx @@ -749,4 +749,37 @@ ހޭޝްގެ އަގު + + ޓެކްސްޓް ހޭޝްކުރޭ + + + ޓެކްސްޓް ހޭޝްކުރޭ + + + ކޮންމެ އަލްގޮރިދަމަކުން ހޭޝް ބެލުމަށް ޓެކްސްޓް ލިޔޭ ނުވަތަ ޕޭސްޓްކުރޭ. ޓެކްސްޓް ހޭޝްކުރެވެނީ އޮތް ގޮތަށް، ތިރީގައި ހޮވާފައިވާ އެންކޯޑިންގ އާއި ލައިން ބްރޭކްތަކާއެކު، ފަހަތަށް ލައިން ބްރޭކެއް އިތުރު ނުކޮށެވެ. + + + ހޭޝްކުރާ ޓެކްސްޓް + + + އެންކޯޑިންގ + + + ލައިން ބްރޭކް + + + LF (Linux، macOS) + + + CRLF (Windows) + + + ސައިޒު: {0} + + + {0} ހޭޝް + + + {0} ހޭޝް ކޮޕީކުރޭ + diff --git a/src/HashTool.App/Lang/Resources.dz-bt.resx b/src/HashTool.App/Lang/Resources.dz-bt.resx index 7c55223..832275a 100644 --- a/src/HashTool.App/Lang/Resources.dz-bt.resx +++ b/src/HashTool.App/Lang/Resources.dz-bt.resx @@ -750,4 +750,37 @@ ཧེ་ཤ་ གནས་གོང་། + + ཚིག་ཡིག་ ཧེ་ཤ། + + + ཚིག་ཡིག་ ཧེ་ཤ། + + + ཚིག་ཡིག་ ཡིག་དཔར་རྐྱབ་ ཡང་ན་ སྦྱར་ཞིནམ་ལས་ རྩིས་ཐབས་ རེ་རེ་གི་ ཧེ་ཤ་ བལྟ། ཚིག་ཡིག་འདི་ འོག་ལུ་ གདམ་ཁ་རྐྱབ་ཡོད་པའི་ ཨིན་ཀོ་ཌིང་ དང་ གྲལ་ཐིག་ བར་ཆད་ཚུ་གིས་ ཡོད་དོ་བཟུམ་སྦེ་ ཧེ་ཤ་ བཟོཝ་ཨིན། མཇུག་ལུ་ གྲལ་ཐིག་ བར་ཆད་ ཁ་སྐོང་མི་འབད། + + + ཧེ་ཤ་ བཟོ་ནིའི་ ཚིག་ཡིག + + + ཨིན་ཀོ་ཌིང་། + + + གྲལ་ཐིག་ བར་ཆད། + + + LF (Linux, macOS) + + + CRLF (Windows) + + + ཚད།: {0} + + + {0} ཧེ་ཤ། + + + {0} ཧེ་ཤ་ འདྲ་བཤུས་རྐྱབ། + diff --git a/src/HashTool.App/Lang/Resources.el-cy.resx b/src/HashTool.App/Lang/Resources.el-cy.resx index 037fb94..f3b513e 100644 --- a/src/HashTool.App/Lang/Resources.el-cy.resx +++ b/src/HashTool.App/Lang/Resources.el-cy.resx @@ -749,4 +749,37 @@ Τιμή hash + + Hash κειμένου + + + Hash κειμένου + + + Πληκτρολογήστε ή επικολλήστε κείμενο για να δείτε το hash του με κάθε αλγόριθμο. Το hash υπολογίζεται από το κείμενο ακριβώς όπως είναι, με την κωδικοποίηση και τις αλλαγές γραμμής που επιλέγονται παρακάτω, χωρίς να προστίθεται αλλαγή γραμμής στο τέλος. + + + Κείμενο για υπολογισμό hash + + + Κωδικοποίηση + + + Αλλαγές γραμμής + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Μέγεθος: {0} + + + Hash {0} + + + Αντιγραφή Hash {0} + diff --git a/src/HashTool.App/Lang/Resources.el-gr.resx b/src/HashTool.App/Lang/Resources.el-gr.resx index 2b490f3..9f24363 100644 --- a/src/HashTool.App/Lang/Resources.el-gr.resx +++ b/src/HashTool.App/Lang/Resources.el-gr.resx @@ -749,4 +749,37 @@ Τιμή hash + + Hash κειμένου + + + Hash κειμένου + + + Πληκτρολογήστε ή επικολλήστε κείμενο για να δείτε το hash του με κάθε αλγόριθμο. Το hash υπολογίζεται από το κείμενο ακριβώς όπως είναι, με την κωδικοποίηση και τις αλλαγές γραμμής που επιλέγονται παρακάτω, χωρίς να προστίθεται αλλαγή γραμμής στο τέλος. + + + Κείμενο για υπολογισμό hash + + + Κωδικοποίηση + + + Αλλαγές γραμμής + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Μέγεθος: {0} + + + Hash {0} + + + Αντιγραφή Hash {0} + diff --git a/src/HashTool.App/Lang/Resources.en-gb.resx b/src/HashTool.App/Lang/Resources.en-gb.resx index 9a5d7a1..32f3cae 100644 --- a/src/HashTool.App/Lang/Resources.en-gb.resx +++ b/src/HashTool.App/Lang/Resources.en-gb.resx @@ -749,4 +749,37 @@ Hash value + + Hash Text + + + Hash Text + + + Type or paste text to see its hash in every algorithm. The text is hashed exactly as it is, in the encoding and line breaks chosen below, with no line break added at the end. + + + Text to hash + + + Encoding + + + Line breaks + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Size: {0} + + + {0} hash + + + Copy {0} hash + diff --git a/src/HashTool.App/Lang/Resources.en-in.resx b/src/HashTool.App/Lang/Resources.en-in.resx index b5d311b..988c8cd 100644 --- a/src/HashTool.App/Lang/Resources.en-in.resx +++ b/src/HashTool.App/Lang/Resources.en-in.resx @@ -749,4 +749,37 @@ Hash value + + Hash Text + + + Hash Text + + + Type or paste text to see its hash in every algorithm. The text is hashed exactly as it is, in the encoding and line breaks chosen below, with no line break added at the end. + + + Text to hash + + + Encoding + + + Line breaks + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Size: {0} + + + {0} hash + + + Copy {0} hash + diff --git a/src/HashTool.App/Lang/Resources.en-sg.resx b/src/HashTool.App/Lang/Resources.en-sg.resx index d9399bb..3f5c254 100644 --- a/src/HashTool.App/Lang/Resources.en-sg.resx +++ b/src/HashTool.App/Lang/Resources.en-sg.resx @@ -749,4 +749,37 @@ Hash value + + Hash Text + + + Hash Text + + + Type or paste text to see its hash in every algorithm. The text is hashed exactly as it is, in the encoding and line breaks chosen below, with no line break added at the end. + + + Text to hash + + + Encoding + + + Line breaks + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Size: {0} + + + {0} hash + + + Copy {0} hash + diff --git a/src/HashTool.App/Lang/Resources.es-419.resx b/src/HashTool.App/Lang/Resources.es-419.resx index f6b0ee2..55b45ac 100644 --- a/src/HashTool.App/Lang/Resources.es-419.resx +++ b/src/HashTool.App/Lang/Resources.es-419.resx @@ -749,4 +749,37 @@ Valor hash + + Hash de texto + + + Hash de texto + + + Escribe o pega un texto para ver su hash con cada algoritmo. El hash se calcula sobre el texto tal cual, con la codificación y los saltos de línea elegidos abajo, sin agregar ningún salto de línea al final. + + + Texto para calcular el hash + + + Codificación + + + Saltos de línea + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Tamaño: {0} + + + Hash {0} + + + Copiar hash {0} + diff --git a/src/HashTool.App/Lang/Resources.es-es.resx b/src/HashTool.App/Lang/Resources.es-es.resx index 71acf94..53c7a98 100644 --- a/src/HashTool.App/Lang/Resources.es-es.resx +++ b/src/HashTool.App/Lang/Resources.es-es.resx @@ -749,4 +749,37 @@ Valor hash + + Hash de texto + + + Hash de texto + + + Escriba o pegue un texto para ver su hash con cada algoritmo. El hash se calcula sobre el texto tal cual, con la codificación y los saltos de línea elegidos abajo, sin añadir ningún salto de línea al final. + + + Texto para calcular el hash + + + Codificación + + + Saltos de línea + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Tamaño: {0} + + + Hash {0} + + + Copiar hash {0} + diff --git a/src/HashTool.App/Lang/Resources.et-ee.resx b/src/HashTool.App/Lang/Resources.et-ee.resx index bf74410..00b29e7 100644 --- a/src/HashTool.App/Lang/Resources.et-ee.resx +++ b/src/HashTool.App/Lang/Resources.et-ee.resx @@ -750,4 +750,37 @@ Räsiväärtus + + Teksti räsi + + + Teksti räsi + + + Sisesta või kleebi tekst, et näha selle räsi kõigi algoritmidega. Tekst räsitakse täpselt sellisena, nagu see on, allpool valitud kodeeringu ja reavahetustega ning lõppu reavahetust ei lisata. + + + Räsitav tekst + + + Kodeering + + + Reavahetused + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Suurus: {0} + + + {0} räsi + + + Kopeeri {0} räsi + diff --git a/src/HashTool.App/Lang/Resources.fa-ir.resx b/src/HashTool.App/Lang/Resources.fa-ir.resx index 7007d07..5f93368 100644 --- a/src/HashTool.App/Lang/Resources.fa-ir.resx +++ b/src/HashTool.App/Lang/Resources.fa-ir.resx @@ -749,4 +749,37 @@ مقدار هش + + هش متن + + + هش متن + + + متن را تایپ یا جایگذاری کنید تا هش آن را با هر الگوریتم ببینید. متن دقیقاً همان‌طور که هست، با کدگذاری و شکست خطی که در پایین انتخاب کرده‌اید، هش می‌شود و در انتهای آن شکست خطی اضافه نمی‌شود. + + + متن برای هش کردن + + + کدگذاری + + + شکست خط + + + LF (Linux، macOS) + + + CRLF (Windows) + + + اندازه: {0} + + + هش {0} + + + کپی هش {0} + diff --git a/src/HashTool.App/Lang/Resources.fi-fi.resx b/src/HashTool.App/Lang/Resources.fi-fi.resx index 6a7bc58..d83c5a0 100644 --- a/src/HashTool.App/Lang/Resources.fi-fi.resx +++ b/src/HashTool.App/Lang/Resources.fi-fi.resx @@ -749,4 +749,37 @@ Tiivistearvo + + Tekstin tiiviste + + + Tekstin tiiviste + + + Kirjoita tai liitä teksti, niin näet sen tiivisteen kaikilla algoritmeilla. Teksti tiivistetään täsmälleen sellaisenaan alla valitulla koodauksella ja rivinvaihdoilla, eikä loppuun lisätä rivinvaihtoa. + + + Tiivistettävä teksti + + + Koodaus + + + Rivinvaihdot + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Koko: {0} + + + {0}-tiiviste + + + Kopioi {0}-tiiviste + diff --git a/src/HashTool.App/Lang/Resources.fil-ph.resx b/src/HashTool.App/Lang/Resources.fil-ph.resx index 286e6bd..9da2e56 100644 --- a/src/HashTool.App/Lang/Resources.fil-ph.resx +++ b/src/HashTool.App/Lang/Resources.fil-ph.resx @@ -749,4 +749,37 @@ Halaga ng hash + + I-hash ang Teksto + + + I-hash ang Teksto + + + Mag-type o mag-paste ng teksto para makita ang hash nito sa bawat algorithm. Iha-hash ang teksto nang eksakto kung ano ito, gamit ang encoding at line break na pinili sa ibaba, nang walang idinadagdag na line break sa dulo. + + + Tekstong iha-hash + + + Encoding + + + Mga line break + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Laki: {0} + + + {0} hash + + + Kopyahin ang {0} hash + diff --git a/src/HashTool.App/Lang/Resources.fr-fr.resx b/src/HashTool.App/Lang/Resources.fr-fr.resx index e355dde..90a00dc 100644 --- a/src/HashTool.App/Lang/Resources.fr-fr.resx +++ b/src/HashTool.App/Lang/Resources.fr-fr.resx @@ -749,4 +749,37 @@ Valeur du hash + + Hacher un texte + + + Hacher un texte + + + Saisissez ou collez du texte pour voir son hash avec chaque algorithme. Le texte est haché tel quel, dans l'encodage et avec les sauts de ligne choisis ci-dessous, sans saut de ligne ajouté à la fin. + + + Texte à hacher + + + Encodage + + + Sauts de ligne + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Taille : {0} + + + Hash {0} + + + Copier le hash {0} + diff --git a/src/HashTool.App/Lang/Resources.he-il.resx b/src/HashTool.App/Lang/Resources.he-il.resx index a1ec64a..57de2cd 100644 --- a/src/HashTool.App/Lang/Resources.he-il.resx +++ b/src/HashTool.App/Lang/Resources.he-il.resx @@ -749,4 +749,37 @@ ערך Hash + + Hash לטקסט + + + Hash לטקסט + + + הקלד או הדבק טקסט כדי לראות את ה-Hash שלו בכל אלגוריתם. ה-Hash מחושב על הטקסט בדיוק כפי שהוא, בקידוד ובמעברי השורה שנבחרו למטה, בלי להוסיף מעבר שורה בסוף. + + + טקסט לחישוב Hash + + + קידוד + + + מעברי שורה + + + LF (Linux, macOS) + + + CRLF (Windows) + + + גודל: {0} + + + Hash של {0} + + + העתק את ה-Hash של {0} + diff --git a/src/HashTool.App/Lang/Resources.hi-in.resx b/src/HashTool.App/Lang/Resources.hi-in.resx index e526815..ed918c4 100644 --- a/src/HashTool.App/Lang/Resources.hi-in.resx +++ b/src/HashTool.App/Lang/Resources.hi-in.resx @@ -749,4 +749,37 @@ हैश मान + + टेक्स्ट हैश करें + + + टेक्स्ट हैश करें + + + हर एल्गोरिदम में उसका हैश देखने के लिए टेक्स्ट टाइप या पेस्ट करें। टेक्स्ट को ठीक वैसा ही हैश किया जाता है जैसा वह है, नीचे चुनी गई एन्कोडिंग और लाइन ब्रेक के साथ, और अंत में कोई लाइन ब्रेक नहीं जोड़ा जाता। + + + हैश करने के लिए टेक्स्ट + + + एन्कोडिंग + + + लाइन ब्रेक + + + LF (Linux, macOS) + + + CRLF (Windows) + + + आकार: {0} + + + {0} हैश + + + {0} हैश कॉपी करें + diff --git a/src/HashTool.App/Lang/Resources.hr-hr.resx b/src/HashTool.App/Lang/Resources.hr-hr.resx index 1416278..07d7cf5 100644 --- a/src/HashTool.App/Lang/Resources.hr-hr.resx +++ b/src/HashTool.App/Lang/Resources.hr-hr.resx @@ -749,4 +749,37 @@ Vrijednost hasha + + Hash teksta + + + Hash teksta + + + Upišite ili zalijepite tekst kako biste vidjeli njegov hash za svaki algoritam. Hash se izračunava iz teksta točno onakvog kakav jest, u kodiranju i s prijelomima redaka odabranima ispod, bez dodavanja prijeloma retka na kraju. + + + Tekst za izračun hasha + + + Kodiranje + + + Prijelomi redaka + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Veličina: {0} + + + Hash {0} + + + Kopiraj hash {0} + diff --git a/src/HashTool.App/Lang/Resources.hu-hu.resx b/src/HashTool.App/Lang/Resources.hu-hu.resx index dd5c35e..f767fad 100644 --- a/src/HashTool.App/Lang/Resources.hu-hu.resx +++ b/src/HashTool.App/Lang/Resources.hu-hu.resx @@ -750,4 +750,37 @@ Hash érték + + Szöveg Hashelése + + + Szöveg Hashelése + + + Írjon be vagy illesszen be szöveget, hogy minden algoritmussal lássa a hashét. A program a szöveget pontosan úgy hasheli, ahogy van, az alább kiválasztott kódolással és sortörésekkel, és nem fűz sortörést a végére. + + + Hashelendő szöveg + + + Kódolás + + + Sortörések + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Méret: {0} + + + {0} hash + + + {0} hash másolása + diff --git a/src/HashTool.App/Lang/Resources.id-id.resx b/src/HashTool.App/Lang/Resources.id-id.resx index 6b9b37b..6a46e41 100644 --- a/src/HashTool.App/Lang/Resources.id-id.resx +++ b/src/HashTool.App/Lang/Resources.id-id.resx @@ -750,4 +750,37 @@ Nilai hash + + Hash Teks + + + Hash Teks + + + Ketik atau tempel teks untuk melihat hash-nya pada setiap algoritma. Teks di-hash persis apa adanya, dengan pengodean dan jeda baris yang dipilih di bawah, tanpa tambahan jeda baris di akhir. + + + Teks yang akan di-hash + + + Pengodean + + + Jeda baris + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Ukuran: {0} + + + Hash {0} + + + Salin Hash {0} + diff --git a/src/HashTool.App/Lang/Resources.is-is.resx b/src/HashTool.App/Lang/Resources.is-is.resx index bcbb40a..6d67ced 100644 --- a/src/HashTool.App/Lang/Resources.is-is.resx +++ b/src/HashTool.App/Lang/Resources.is-is.resx @@ -749,4 +749,37 @@ Hash-gildi + + Hash texta + + + Hash texta + + + Sláðu inn eða límdu texta til að sjá hash-gildi hans fyrir hvert reiknirit. Hash-gildið er reiknað af textanum nákvæmlega eins og hann er, með kóðuninni og línuskilunum sem valin eru hér fyrir neðan, án þess að línuskilum sé bætt við í lokin. + + + Texti til að reikna hash af + + + Kóðun + + + Línuskil + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Stærð: {0} + + + {0}-hash + + + Afrita {0}-hash + diff --git a/src/HashTool.App/Lang/Resources.it-it.resx b/src/HashTool.App/Lang/Resources.it-it.resx index 8304515..223bac5 100644 --- a/src/HashTool.App/Lang/Resources.it-it.resx +++ b/src/HashTool.App/Lang/Resources.it-it.resx @@ -749,4 +749,37 @@ Valore hash + + Hash del testo + + + Hash del testo + + + Digita o incolla del testo per vederne l'hash con ogni algoritmo. L'hash viene calcolato sul testo così com'è, con la codifica e i fine riga scelti qui sotto, senza aggiungere un a capo alla fine. + + + Testo di cui calcolare l'hash + + + Codifica + + + Fine riga + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Dimensione: {0} + + + Hash {0} + + + Copia hash {0} + diff --git a/src/HashTool.App/Lang/Resources.ja-jp.resx b/src/HashTool.App/Lang/Resources.ja-jp.resx index eb89a3a..a62935d 100644 --- a/src/HashTool.App/Lang/Resources.ja-jp.resx +++ b/src/HashTool.App/Lang/Resources.ja-jp.resx @@ -749,4 +749,37 @@ ハッシュ値 + + テキストハッシュ + + + テキストハッシュ + + + テキストを入力するか貼り付けると、各アルゴリズムでのハッシュが表示されます。テキストは下で選択した文字コードと改行コードでそのままハッシュ化され、末尾に改行は追加されません。 + + + ハッシュ化するテキスト + + + 文字コード + + + 改行コード + + + LF (Linux, macOS) + + + CRLF (Windows) + + + サイズ: {0} + + + {0} ハッシュ + + + {0} ハッシュをコピー + diff --git a/src/HashTool.App/Lang/Resources.kk-kz.resx b/src/HashTool.App/Lang/Resources.kk-kz.resx index 8e8d05b..56d8adc 100644 --- a/src/HashTool.App/Lang/Resources.kk-kz.resx +++ b/src/HashTool.App/Lang/Resources.kk-kz.resx @@ -749,4 +749,37 @@ Хэш мәні + + Мәтінді хэштеу + + + Мәтінді хэштеу + + + Әр алгоритм бойынша хэшін көру үшін мәтінді теріңіз немесе қойыңыз. Мәтін дәл сол күйінде, төменде таңдалған кодтаумен және жол ауыстыру таңбаларымен хэштеледі; соңына жол ауыстыру қосылмайды. + + + Хэштелетін мәтін + + + Кодтау + + + Жол ауыстыру + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Өлшемі: {0} + + + {0} хэші + + + {0} хэшін көшіру + diff --git a/src/HashTool.App/Lang/Resources.km-kh.resx b/src/HashTool.App/Lang/Resources.km-kh.resx index 108bfaf..9c8449b 100644 --- a/src/HashTool.App/Lang/Resources.km-kh.resx +++ b/src/HashTool.App/Lang/Resources.km-kh.resx @@ -749,4 +749,37 @@ តម្លៃ Hash + + Hash អត្ថបទ + + + Hash អត្ថបទ + + + វាយ ឬបិទភ្ជាប់អត្ថបទ ដើម្បីមើល Hash របស់វាតាមគ្រប់ក្បួនដោះស្រាយ។ អត្ថបទត្រូវបាន Hash តាមដែលវាមានពិតប្រាកដ ជាមួយការអ៊ិនកូដ និងការចុះបន្ទាត់ដែលបានជ្រើសនៅខាងក្រោម ដោយមិនបន្ថែមការចុះបន្ទាត់នៅខាងចុងទេ។ + + + អត្ថបទដែលត្រូវ Hash + + + ការអ៊ិនកូដ + + + ការចុះបន្ទាត់ + + + LF (Linux, macOS) + + + CRLF (Windows) + + + ទំហំ៖ {0} + + + Hash {0} + + + ចម្លង Hash {0} + diff --git a/src/HashTool.App/Lang/Resources.ko-kr.resx b/src/HashTool.App/Lang/Resources.ko-kr.resx index 84e20bb..f497384 100644 --- a/src/HashTool.App/Lang/Resources.ko-kr.resx +++ b/src/HashTool.App/Lang/Resources.ko-kr.resx @@ -749,4 +749,37 @@ 해시 값 + + 텍스트 해시 + + + 텍스트 해시 + + + 텍스트를 입력하거나 붙여넣으면 모든 알고리즘의 해시가 표시됩니다. 텍스트는 아래에서 선택한 인코딩과 줄 바꿈으로 있는 그대로 해시되며, 끝에 줄 바꿈이 추가되지 않습니다. + + + 해시할 텍스트 + + + 인코딩 + + + 줄 바꿈 + + + LF (Linux, macOS) + + + CRLF (Windows) + + + 크기: {0} + + + {0} 해시 + + + {0} 해시 복사 + diff --git a/src/HashTool.App/Lang/Resources.ky-kg.resx b/src/HashTool.App/Lang/Resources.ky-kg.resx index 172902d..14d3be9 100644 --- a/src/HashTool.App/Lang/Resources.ky-kg.resx +++ b/src/HashTool.App/Lang/Resources.ky-kg.resx @@ -749,4 +749,37 @@ Хэш мааниси + + Текстти хэштөө + + + Текстти хэштөө + + + Ар бир алгоритм боюнча хэшин көрүү үчүн текстти териңиз же чаптаңыз. Текст дал ошол бойдон, төмөндө тандалган коддоо жана сап которуу белгилери менен хэштелет; аягына сап которуу кошулбайт. + + + Хэштеле турган текст + + + Коддоо + + + Сап которуу + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Өлчөмү: {0} + + + {0} хэши + + + {0} хэшин көчүрүү + diff --git a/src/HashTool.App/Lang/Resources.lo-la.resx b/src/HashTool.App/Lang/Resources.lo-la.resx index 3c7cfb0..f216d48 100644 --- a/src/HashTool.App/Lang/Resources.lo-la.resx +++ b/src/HashTool.App/Lang/Resources.lo-la.resx @@ -749,4 +749,37 @@ ຄ່າ Hash + + Hash ຂໍ້ຄວາມ + + + Hash ຂໍ້ຄວາມ + + + ພິມ ຫຼື ວາງຂໍ້ຄວາມເພື່ອເບິ່ງ Hash ຂອງມັນໃນທຸກອັນກໍຣິທຶມ. ຂໍ້ຄວາມຈະຖືກ Hash ຕາມທີ່ມັນເປັນທຸກປະການ, ດ້ວຍການເຂົ້າລະຫັດ ແລະ ການຂຶ້ນແຖວໃໝ່ທີ່ເລືອກໄວ້ດ້ານລຸ່ມ, ໂດຍບໍ່ເພີ່ມການຂຶ້ນແຖວໃໝ່ຕໍ່ທ້າຍ. + + + ຂໍ້ຄວາມທີ່ຈະ Hash + + + ການເຂົ້າລະຫັດ + + + ການຂຶ້ນແຖວໃໝ່ + + + LF (Linux, macOS) + + + CRLF (Windows) + + + ຂະໜາດ: {0} + + + Hash {0} + + + ສຳເນົາ Hash {0} + diff --git a/src/HashTool.App/Lang/Resources.lt-lt.resx b/src/HashTool.App/Lang/Resources.lt-lt.resx index c2e5d47..c79a40a 100644 --- a/src/HashTool.App/Lang/Resources.lt-lt.resx +++ b/src/HashTool.App/Lang/Resources.lt-lt.resx @@ -749,4 +749,37 @@ Hash reikšmė + + Teksto Hash + + + Teksto Hash + + + Įveskite arba įklijuokite tekstą, kad pamatytumėte jo Hash reikšmę kiekvienu algoritmu. Hash apskaičiuojamas tekstui tiksliai tokiam, koks jis yra, naudojant žemiau pasirinktą koduotę ir eilučių pabaigas; pabaigoje eilutės pabaiga nepridedama. + + + Tekstas Hash apskaičiavimui + + + Koduotė + + + Eilučių pabaigos + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Dydis: {0} + + + {0} Hash reikšmė + + + Kopijuoti {0} Hash reikšmę + diff --git a/src/HashTool.App/Lang/Resources.lv-lv.resx b/src/HashTool.App/Lang/Resources.lv-lv.resx index fb95424..2a6ac26 100644 --- a/src/HashTool.App/Lang/Resources.lv-lv.resx +++ b/src/HashTool.App/Lang/Resources.lv-lv.resx @@ -749,4 +749,37 @@ Hash vērtība + + Teksta Hash + + + Teksta Hash + + + Ievadiet vai ielīmējiet tekstu, lai redzētu tā hash vērtību katram algoritmam. Hash tiek aprēķināts no teksta tieši tāda, kāds tas ir, ar zemāk izvēlēto kodējumu un rindu beigām, beigās nepievienojot jaunu rindu. + + + Teksts hash aprēķināšanai + + + Kodējums + + + Rindu beigas + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Izmērs: {0} + + + {0} hash vērtība + + + Kopēt {0} hash vērtību + diff --git a/src/HashTool.App/Lang/Resources.mk-mk.resx b/src/HashTool.App/Lang/Resources.mk-mk.resx index cfd2516..0307d52 100644 --- a/src/HashTool.App/Lang/Resources.mk-mk.resx +++ b/src/HashTool.App/Lang/Resources.mk-mk.resx @@ -749,4 +749,37 @@ Вредност на хешот + + Хеш на текст + + + Хеш на текст + + + Внесете или залепете текст за да го видите неговиот хеш за секој алгоритам. Хешот се пресметува од текстот токму таков каков што е, со кодирањето и прекините на ред избрани подолу, без да се додава нов ред на крајот. + + + Текст за хеширање + + + Кодирање + + + Прекини на ред + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Големина: {0} + + + Хеш {0} + + + Копирај Хеш {0} + diff --git a/src/HashTool.App/Lang/Resources.mn-mn.resx b/src/HashTool.App/Lang/Resources.mn-mn.resx index 01e5f62..1d7a618 100644 --- a/src/HashTool.App/Lang/Resources.mn-mn.resx +++ b/src/HashTool.App/Lang/Resources.mn-mn.resx @@ -749,4 +749,37 @@ Хэшийн утга + + Текст хэшлэх + + + Текст хэшлэх + + + Текст бичиж эсвэл буулгаж, алгоритм бүрийн хэшийг харна уу. Текстийг яг байгаа чигээр нь, доор сонгосон кодчилол болон мөр шилжүүлэлтээр хэшлэх бөгөөд төгсгөлд нь мөр шилжүүлэлт нэмэхгүй. + + + Хэшлэх текст + + + Кодчилол + + + Мөр шилжүүлэлт + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Хэмжээ: {0} + + + {0} хэш + + + {0} хэш хуулах + diff --git a/src/HashTool.App/Lang/Resources.ms-my.resx b/src/HashTool.App/Lang/Resources.ms-my.resx index 0ad501a..74eb808 100644 --- a/src/HashTool.App/Lang/Resources.ms-my.resx +++ b/src/HashTool.App/Lang/Resources.ms-my.resx @@ -749,4 +749,37 @@ Nilai hash + + Hash Teks + + + Hash Teks + + + Taip atau tampal teks untuk melihat hash teks itu bagi setiap algoritma. Hash dikira daripada teks tepat seperti asalnya, dengan pengekodan dan pemisah baris yang dipilih di bawah, tanpa menambah pemisah baris di hujung. + + + Teks untuk di-hash + + + Pengekodan + + + Pemisah baris + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Saiz: {0} + + + Hash {0} + + + Salin Hash {0} + diff --git a/src/HashTool.App/Lang/Resources.my-mm.resx b/src/HashTool.App/Lang/Resources.my-mm.resx index 30651d3..42f7ac7 100644 --- a/src/HashTool.App/Lang/Resources.my-mm.resx +++ b/src/HashTool.App/Lang/Resources.my-mm.resx @@ -749,4 +749,37 @@ Hash တန်ဖိုး + + စာသား Hash လုပ်ရန် + + + စာသား Hash လုပ်ရန် + + + စာသားကို ရိုက်ထည့်ပါ သို့မဟုတ် Paste လုပ်ပါ၊ အယ်လဂိုရီသမ်တိုင်းအတွက် ၎င်း၏ Hash ကို မြင်ရပါမည်။ စာသားကို အောက်တွင် ရွေးထားသော ကုဒ်စနစ်နှင့် စာကြောင်းခွဲဖြင့် ရှိသည့်အတိုင်း အတိအကျ Hash လုပ်ပြီး အဆုံးတွင် စာကြောင်းခွဲ ထပ်မထည့်ပါ။ + + + Hash လုပ်မည့် စာသား + + + ကုဒ်စနစ် + + + စာကြောင်းခွဲ + + + LF (Linux, macOS) + + + CRLF (Windows) + + + အရွယ်အစား: {0} + + + {0} Hash + + + {0} Hash ကို ကူးယူရန် + diff --git a/src/HashTool.App/Lang/Resources.nb-no.resx b/src/HashTool.App/Lang/Resources.nb-no.resx index bafdeb2..5789bc4 100644 --- a/src/HashTool.App/Lang/Resources.nb-no.resx +++ b/src/HashTool.App/Lang/Resources.nb-no.resx @@ -749,4 +749,37 @@ Hash-verdi + + Hash tekst + + + Hash tekst + + + Skriv inn eller lim inn tekst for å se hashen for hver algoritme. Teksten hashes nøyaktig slik den er, med kodingen og linjeskiftene som er valgt nedenfor, og det legges ikke til noe linjeskift på slutten. + + + Tekst som skal hashes + + + Koding + + + Linjeskift + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Størrelse: {0} + + + {0}-hash + + + Kopier {0}-hash + diff --git a/src/HashTool.App/Lang/Resources.ne-np.resx b/src/HashTool.App/Lang/Resources.ne-np.resx index 5465148..1001fef 100644 --- a/src/HashTool.App/Lang/Resources.ne-np.resx +++ b/src/HashTool.App/Lang/Resources.ne-np.resx @@ -749,4 +749,37 @@ ह्यास मान + + पाठ ह्यास गर्नुहोस् + + + पाठ ह्यास गर्नुहोस् + + + हरेक एल्गोरिदममा यसको ह्यास हेर्न पाठ टाइप गर्नुहोस् वा टाँस्नुहोस्। पाठलाई जस्ताको तस्तै, तल छानिएको इन्कोडिङ र लाइन ब्रेकसहित ह्यास गरिन्छ, र अन्त्यमा कुनै लाइन ब्रेक थपिँदैन। + + + ह्यास गर्ने पाठ + + + इन्कोडिङ + + + लाइन ब्रेक + + + LF (Linux, macOS) + + + CRLF (Windows) + + + साइज: {0} + + + {0} ह्यास + + + {0} ह्यास प्रतिलिपि गर्नुहोस् + diff --git a/src/HashTool.App/Lang/Resources.nl-be.resx b/src/HashTool.App/Lang/Resources.nl-be.resx index bd5602d..028b810 100644 --- a/src/HashTool.App/Lang/Resources.nl-be.resx +++ b/src/HashTool.App/Lang/Resources.nl-be.resx @@ -749,4 +749,37 @@ Hashwaarde + + Tekst Hashen + + + Tekst Hashen + + + Typ of plak tekst om de hash ervan voor elk algoritme te zien. De tekst wordt gehasht precies zoals hij is, met de hieronder gekozen codering en regeleinden, en zonder extra regeleinde aan het eind. + + + Te hashen tekst + + + Codering + + + Regeleinden + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Grootte: {0} + + + {0}-hash + + + {0}-hash kopiëren + diff --git a/src/HashTool.App/Lang/Resources.nl-nl.resx b/src/HashTool.App/Lang/Resources.nl-nl.resx index 12407b9..cc6be72 100644 --- a/src/HashTool.App/Lang/Resources.nl-nl.resx +++ b/src/HashTool.App/Lang/Resources.nl-nl.resx @@ -749,4 +749,37 @@ Hashwaarde + + Tekst Hashen + + + Tekst Hashen + + + Typ of plak tekst om de hash ervan voor elk algoritme te zien. De tekst wordt gehasht precies zoals hij is, met de hieronder gekozen codering en regeleinden, en zonder extra regeleinde aan het eind. + + + Te hashen tekst + + + Codering + + + Regeleinden + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Grootte: {0} + + + {0}-hash + + + {0}-hash kopiëren + diff --git a/src/HashTool.App/Lang/Resources.pl-pl.resx b/src/HashTool.App/Lang/Resources.pl-pl.resx index 85b4e9a..ce3c316 100644 --- a/src/HashTool.App/Lang/Resources.pl-pl.resx +++ b/src/HashTool.App/Lang/Resources.pl-pl.resx @@ -749,4 +749,37 @@ Wartość hash + + Hash tekstu + + + Hash tekstu + + + Wpisz lub wklej tekst, aby zobaczyć jego hash dla każdego algorytmu. Hash jest obliczany z tekstu dokładnie w takiej postaci, w jakiej jest, z kodowaniem i końcami wierszy wybranymi poniżej, bez dodawania znaku nowego wiersza na końcu. + + + Tekst do zahashowania + + + Kodowanie + + + Końce wierszy + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Rozmiar: {0} + + + Hash {0} + + + Kopiuj hash {0} + diff --git a/src/HashTool.App/Lang/Resources.ps-af.resx b/src/HashTool.App/Lang/Resources.ps-af.resx index 27fffad..c541a32 100644 --- a/src/HashTool.App/Lang/Resources.ps-af.resx +++ b/src/HashTool.App/Lang/Resources.ps-af.resx @@ -749,4 +749,37 @@ د هیش ارزښت + + متن هیش کول + + + متن هیش کول + + + متن ولیکئ یا یې پیسټ کړئ ترڅو د هر الګوریتم لپاره یې هیش وګورئ. متن هماغسې چې دی، د لاندې ټاکل شوې کوډبندۍ او د کرښې ماتولو سره هیش کیږي، او په پای کې یې د کرښې ماتول نه ورزیاتیږي. + + + د هیش کولو لپاره متن + + + کوډبندي + + + د کرښې ماتول + + + LF (Linux، macOS) + + + CRLF (Windows) + + + اندازه: {0} + + + د {0} هیش + + + د {0} هیش کاپي کول + diff --git a/src/HashTool.App/Lang/Resources.pt-br.resx b/src/HashTool.App/Lang/Resources.pt-br.resx index a5810c4..d6158e3 100644 --- a/src/HashTool.App/Lang/Resources.pt-br.resx +++ b/src/HashTool.App/Lang/Resources.pt-br.resx @@ -749,4 +749,37 @@ Valor do hash + + Hash de Texto + + + Hash de Texto + + + Digite ou cole um texto para ver o hash dele em cada algoritmo. O hash é calculado sobre o texto exatamente como ele está, com a codificação e as quebras de linha escolhidas abaixo, sem adicionar nenhuma quebra de linha no final. + + + Texto para calcular o hash + + + Codificação + + + Quebras de linha + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Tamanho: {0} + + + Hash {0} + + + Copiar Hash {0} + diff --git a/src/HashTool.App/Lang/Resources.resx b/src/HashTool.App/Lang/Resources.resx index 9f5319f..c7b01bc 100644 --- a/src/HashTool.App/Lang/Resources.resx +++ b/src/HashTool.App/Lang/Resources.resx @@ -749,4 +749,37 @@ Hash value + + Hash Text + + + Hash Text + + + Type or paste text to see its hash in every algorithm. The text is hashed exactly as it is, in the encoding and line breaks chosen below, with no line break added at the end. + + + Text to hash + + + Encoding + + + Line breaks + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Size: {0} + + + {0} hash + + + Copy {0} hash + diff --git a/src/HashTool.App/Lang/Resources.ro-ro.resx b/src/HashTool.App/Lang/Resources.ro-ro.resx index ceffa62..e68ef54 100644 --- a/src/HashTool.App/Lang/Resources.ro-ro.resx +++ b/src/HashTool.App/Lang/Resources.ro-ro.resx @@ -749,4 +749,37 @@ Valoare hash + + Hash pentru text + + + Hash pentru text + + + Tastați sau lipiți text pentru a vedea hash-ul acestuia cu fiecare algoritm. Hash-ul se calculează din text exact așa cum este, cu codificarea și sfârșiturile de linie alese mai jos, fără a adăuga un sfârșit de linie la final. + + + Text pentru hash + + + Codificare + + + Sfârșituri de linie + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Dimensiune: {0} + + + Hash {0} + + + Copiază hash-ul {0} + diff --git a/src/HashTool.App/Lang/Resources.ru-ru.resx b/src/HashTool.App/Lang/Resources.ru-ru.resx index ddac308..bec1f52 100644 --- a/src/HashTool.App/Lang/Resources.ru-ru.resx +++ b/src/HashTool.App/Lang/Resources.ru-ru.resx @@ -749,4 +749,37 @@ Значение хэша + + Хэшировать текст + + + Хэшировать текст + + + Введите или вставьте текст, чтобы увидеть его хэш для каждого алгоритма. Текст хэшируется в точности как есть — с кодировкой и переводами строк, выбранными ниже, и без перевода строки в конце. + + + Текст для хэширования + + + Кодировка + + + Переводы строк + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Размер: {0} + + + Хэш {0} + + + Копировать хэш {0} + diff --git a/src/HashTool.App/Lang/Resources.si-lk.resx b/src/HashTool.App/Lang/Resources.si-lk.resx index 1e6e31b..f96882b 100644 --- a/src/HashTool.App/Lang/Resources.si-lk.resx +++ b/src/HashTool.App/Lang/Resources.si-lk.resx @@ -749,4 +749,37 @@ Hash අගය + + පෙළ Hash කරන්න + + + පෙළ Hash කරන්න + + + සෑම ඇල්ගොරිතමයකින්ම එහි Hash බැලීමට පෙළ ටයිප් කරන්න හෝ අලවන්න. පෙළ පහත තෝරාගත් කේතනය සහ පේළි බිඳීම් සමඟ තිබෙන ආකාරයෙන්ම Hash කෙරෙන අතර, අවසානයට පේළි බිඳීමක් එක් නොකෙරේ. + + + Hash කළ යුතු පෙළ + + + කේතනය + + + පේළි බිඳීම් + + + LF (Linux, macOS) + + + CRLF (Windows) + + + ප්‍රමාණය: {0} + + + {0} Hash + + + {0} Hash පිටපත් කරන්න + diff --git a/src/HashTool.App/Lang/Resources.sk-sk.resx b/src/HashTool.App/Lang/Resources.sk-sk.resx index a1c502e..4404085 100644 --- a/src/HashTool.App/Lang/Resources.sk-sk.resx +++ b/src/HashTool.App/Lang/Resources.sk-sk.resx @@ -749,4 +749,37 @@ Hodnota hashu + + Hashovať text + + + Hashovať text + + + Napíšte alebo vložte text a zobrazí sa jeho hash pre každý algoritmus. Text sa hashuje presne tak, ako je, v kódovaní a s koncami riadkov zvolenými nižšie, bez pridania nového riadka na konci. + + + Text na hashovanie + + + Kódovanie + + + Konce riadkov + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Veľkosť: {0} + + + Hash {0} + + + Kopírovať hash {0} + diff --git a/src/HashTool.App/Lang/Resources.sl-si.resx b/src/HashTool.App/Lang/Resources.sl-si.resx index 0fadda6..b8c7943 100644 --- a/src/HashTool.App/Lang/Resources.sl-si.resx +++ b/src/HashTool.App/Lang/Resources.sl-si.resx @@ -749,4 +749,37 @@ Vrednost hasha + + Hash besedila + + + Hash besedila + + + Vnesite ali prilepite besedilo, da vidite njegov hash za vsak algoritem. Hash se izračuna iz besedila natanko takšnega, kot je, v kodiranju in s prelomi vrstic, izbranimi spodaj, brez dodanega preloma vrstice na koncu. + + + Besedilo za izračun hasha + + + Kodiranje + + + Prelomi vrstic + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Velikost: {0} + + + Hash {0} + + + Kopiraj hash {0} + diff --git a/src/HashTool.App/Lang/Resources.sq-al.resx b/src/HashTool.App/Lang/Resources.sq-al.resx index 2a1f565..e1b11f7 100644 --- a/src/HashTool.App/Lang/Resources.sq-al.resx +++ b/src/HashTool.App/Lang/Resources.sq-al.resx @@ -749,4 +749,37 @@ Vlera e hash-it + + Hash i tekstit + + + Hash i tekstit + + + Shkruani ose ngjitni tekst për të parë hash-in e tij me çdo algoritëm. Hash-i llogaritet nga teksti saktësisht ashtu siç është, me kodimin dhe ndërprerjet e rreshtave të zgjedhura më poshtë, pa shtuar ndërprerje rreshti në fund. + + + Teksti për hash + + + Kodimi + + + Ndërprerjet e rreshtave + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Madhësia: {0} + + + Hash-i {0} + + + Kopjo hash-in {0} + diff --git a/src/HashTool.App/Lang/Resources.sr-cyrl-rs.resx b/src/HashTool.App/Lang/Resources.sr-cyrl-rs.resx index 743eb86..8b9d05a 100644 --- a/src/HashTool.App/Lang/Resources.sr-cyrl-rs.resx +++ b/src/HashTool.App/Lang/Resources.sr-cyrl-rs.resx @@ -749,4 +749,37 @@ Вредност хеша + + Хеш текста + + + Хеш текста + + + Унесите или налепите текст да бисте видели његов хеш за сваки алгоритам. Хеш се рачуна из текста тачно онаквог какав јесте, у кодирању и са преломима редова изабраним испод, без додавања прелома реда на крају. + + + Текст за израчунавање хеша + + + Кодирање + + + Преломи редова + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Величина: {0} + + + Хеш {0} + + + Копирај хеш {0} + diff --git a/src/HashTool.App/Lang/Resources.sv-se.resx b/src/HashTool.App/Lang/Resources.sv-se.resx index 38b58b0..cda5ac6 100644 --- a/src/HashTool.App/Lang/Resources.sv-se.resx +++ b/src/HashTool.App/Lang/Resources.sv-se.resx @@ -749,4 +749,37 @@ Hashvärde + + Hasha text + + + Hasha text + + + Skriv eller klistra in text för att se dess hash med varje algoritm. Texten hashas exakt som den är, med den kodning och de radbrytningar som valts nedan, och ingen radbrytning läggs till i slutet. + + + Text att hasha + + + Kodning + + + Radbrytningar + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Storlek: {0} + + + {0}-hash + + + Kopiera {0}-hash + diff --git a/src/HashTool.App/Lang/Resources.tg-tj.resx b/src/HashTool.App/Lang/Resources.tg-tj.resx index f6462b2..4f59c25 100644 --- a/src/HashTool.App/Lang/Resources.tg-tj.resx +++ b/src/HashTool.App/Lang/Resources.tg-tj.resx @@ -749,4 +749,37 @@ Қимати ҳэш + + Ҳэши матн + + + Ҳэши матн + + + Матнро нависед ё часбонед, то ҳэши онро барои ҳар як алгоритм бинед. Матн айнан ҳамон тавре ки ҳаст, бо рамзгузорӣ ва гузариши сатре, ки дар поён интихоб шудаанд, ҳэш карда мешавад ва дар охир сатри нав илова намегардад. + + + Матн барои ҳэш кардан + + + Рамзгузорӣ + + + Гузариши сатр + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Андоза: {0} + + + Ҳэши {0} + + + Нусхабардории ҳэши {0} + diff --git a/src/HashTool.App/Lang/Resources.th-th.resx b/src/HashTool.App/Lang/Resources.th-th.resx index ebdef88..f9b66eb 100644 --- a/src/HashTool.App/Lang/Resources.th-th.resx +++ b/src/HashTool.App/Lang/Resources.th-th.resx @@ -749,4 +749,37 @@ ค่าแฮช + + แฮชข้อความ + + + แฮชข้อความ + + + พิมพ์หรือวางข้อความเพื่อดูค่าแฮชในทุกอัลกอริทึม ข้อความจะถูกแฮชตามที่เป็นอยู่ทุกประการ ด้วยการเข้ารหัสและการขึ้นบรรทัดใหม่ที่เลือกไว้ด้านล่าง โดยไม่เพิ่มการขึ้นบรรทัดใหม่ต่อท้าย + + + ข้อความที่จะแฮช + + + การเข้ารหัส + + + การขึ้นบรรทัดใหม่ + + + LF (Linux, macOS) + + + CRLF (Windows) + + + ขนาด: {0} + + + แฮช {0} + + + คัดลอกแฮช {0} + diff --git a/src/HashTool.App/Lang/Resources.tk-tm.resx b/src/HashTool.App/Lang/Resources.tk-tm.resx index 69053ef..babf368 100644 --- a/src/HashTool.App/Lang/Resources.tk-tm.resx +++ b/src/HashTool.App/Lang/Resources.tk-tm.resx @@ -749,4 +749,37 @@ Heş bahasy + + Tekstiň heşi + + + Tekstiň heşi + + + Her algoritm boýunça heşini görmek üçin tekst ýazyň ýa-da ýelmäň. Tekst aşakda saýlanan kodlama we setir geçişleri bilen edil bolşy ýaly heşlenýär, ahyryna setir geçişi goşulmaýar. + + + Heşlenjek tekst + + + Kodlama + + + Setir geçişleri + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Ölçegi: {0} + + + {0} heşi + + + {0} heşini göçür + diff --git a/src/HashTool.App/Lang/Resources.tr-tr.resx b/src/HashTool.App/Lang/Resources.tr-tr.resx index 253538c..976980d 100644 --- a/src/HashTool.App/Lang/Resources.tr-tr.resx +++ b/src/HashTool.App/Lang/Resources.tr-tr.resx @@ -749,4 +749,37 @@ Hash değeri + + Metin Hash'i + + + Metin Hash'i + + + Bir metin yazın veya yapıştırın; metnin her algoritmadaki hash'i görüntülenir. Metin, aşağıda seçilen kodlama ve satır sonlarıyla tam olarak olduğu gibi hash'lenir ve sonuna satır sonu eklenmez. + + + Hash'lenecek metin + + + Kodlama + + + Satır sonları + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Boyut: {0} + + + {0} hash değeri + + + {0} Hash Değerini Kopyala + diff --git a/src/HashTool.App/Lang/Resources.uk-ua.resx b/src/HashTool.App/Lang/Resources.uk-ua.resx index 2e98ee0..e5a6136 100644 --- a/src/HashTool.App/Lang/Resources.uk-ua.resx +++ b/src/HashTool.App/Lang/Resources.uk-ua.resx @@ -749,4 +749,37 @@ Значення хешу + + Хешувати текст + + + Хешувати текст + + + Введіть або вставте текст, щоб побачити його хеш для кожного алгоритму. Текст хешується точно як є — з кодуванням і кінцями рядків, вибраними нижче, і без додавання нового рядка в кінці. + + + Текст для хешування + + + Кодування + + + Кінці рядків + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Розмір: {0} + + + Хеш {0} + + + Копіювати хеш {0} + diff --git a/src/HashTool.App/Lang/Resources.vi-vn.resx b/src/HashTool.App/Lang/Resources.vi-vn.resx index 44a66dd..712a4f9 100644 --- a/src/HashTool.App/Lang/Resources.vi-vn.resx +++ b/src/HashTool.App/Lang/Resources.vi-vn.resx @@ -749,4 +749,37 @@ Giá trị băm + + Băm văn bản + + + Băm văn bản + + + Nhập hoặc dán văn bản để xem mã băm của nó theo từng thuật toán. Văn bản được băm đúng nguyên văn, với bảng mã và kiểu xuống dòng được chọn bên dưới, không thêm dấu xuống dòng ở cuối. + + + Văn bản cần băm + + + Bảng mã + + + Kiểu xuống dòng + + + LF (Linux, macOS) + + + CRLF (Windows) + + + Kích thước: {0} + + + Mã băm {0} + + + Sao chép mã băm {0} + diff --git a/src/HashTool.App/Lang/Resources.zh-hans-cn.resx b/src/HashTool.App/Lang/Resources.zh-hans-cn.resx index 148faf3..422b7a4 100644 --- a/src/HashTool.App/Lang/Resources.zh-hans-cn.resx +++ b/src/HashTool.App/Lang/Resources.zh-hans-cn.resx @@ -749,4 +749,37 @@ 哈希值 + + 文本哈希 + + + 文本哈希 + + + 输入或粘贴文本,即可查看它在每种算法下的哈希值。文本会按原样进行哈希,使用下方选择的编码和换行符,末尾不会添加换行符。 + + + 要计算哈希的文本 + + + 编码 + + + 换行符 + + + LF (Linux, macOS) + + + CRLF (Windows) + + + 大小:{0} + + + {0} 哈希值 + + + 复制 {0} 哈希值 + diff --git a/src/HashTool.App/Lang/Resources.zh-hans-sg.resx b/src/HashTool.App/Lang/Resources.zh-hans-sg.resx index 148faf3..422b7a4 100644 --- a/src/HashTool.App/Lang/Resources.zh-hans-sg.resx +++ b/src/HashTool.App/Lang/Resources.zh-hans-sg.resx @@ -749,4 +749,37 @@ 哈希值 + + 文本哈希 + + + 文本哈希 + + + 输入或粘贴文本,即可查看它在每种算法下的哈希值。文本会按原样进行哈希,使用下方选择的编码和换行符,末尾不会添加换行符。 + + + 要计算哈希的文本 + + + 编码 + + + 换行符 + + + LF (Linux, macOS) + + + CRLF (Windows) + + + 大小:{0} + + + {0} 哈希值 + + + 复制 {0} 哈希值 + diff --git a/src/HashTool.App/Lang/Resources.zh-hant.resx b/src/HashTool.App/Lang/Resources.zh-hant.resx index 6c748bf..07e40c1 100644 --- a/src/HashTool.App/Lang/Resources.zh-hant.resx +++ b/src/HashTool.App/Lang/Resources.zh-hant.resx @@ -749,4 +749,37 @@ 雜湊值 + + 文字雜湊 + + + 文字雜湊 + + + 輸入或貼上文字,即可查看它在每種演算法下的雜湊值。文字會依原樣進行雜湊,使用下方選擇的編碼和換行字元,結尾不會加上換行字元。 + + + 要計算雜湊的文字 + + + 編碼 + + + 換行字元 + + + LF (Linux, macOS) + + + CRLF (Windows) + + + 大小:{0} + + + {0} 雜湊值 + + + 複製 {0} 雜湊值 + diff --git a/src/HashTool.App/ViewModels/MainWindowViewModel.cs b/src/HashTool.App/ViewModels/MainWindowViewModel.cs index e63dd61..5a287d3 100644 --- a/src/HashTool.App/ViewModels/MainWindowViewModel.cs +++ b/src/HashTool.App/ViewModels/MainWindowViewModel.cs @@ -23,12 +23,13 @@ public sealed partial class MainWindowViewModel : ObservableObject [ObservableProperty] private bool _isPaneOpen = true; [ObservableProperty] private string? _noticeText; - public MainWindowViewModel(CreateHashViewModel create, CheckHashViewModel check, SettingsViewModel settingsPage, + public MainWindowViewModel(CreateHashViewModel create, CheckHashViewModel check, TextHashViewModel text, SettingsViewModel settingsPage, UpdateViewModel update, AboutViewModel about, DeveloperViewModel developer, SettingsService settings, LocalizationService localization, FontService fonts, ThemeService theme, ActivationService activation) { Create = create; Check = check; + Text = text; SettingsPage = settingsPage; Update = update; About = about; @@ -66,6 +67,7 @@ public sealed partial class MainWindowViewModel : ObservableObject public CreateHashViewModel Create { get; } public CheckHashViewModel Check { get; } + public TextHashViewModel Text { get; } public SettingsViewModel SettingsPage { get; } public UpdateViewModel Update { get; } public AboutViewModel About { get; } @@ -95,6 +97,7 @@ public sealed partial class MainWindowViewModel : ObservableObject public string CurrentPageName => CurrentPage switch { CheckHashViewModel => "Check", + TextHashViewModel => "Text", SettingsViewModel => "Settings", UpdateViewModel => "Update", AboutViewModel => "About", @@ -147,10 +150,12 @@ public sealed partial class MainWindowViewModel : ObservableObject [RelayCommand] private void Navigate(string page) { - if (IsBusy && page is not ("Create" or "Check")) return; + // Hashing text works while a list is busy; the other pages wait until the run ends. + if (IsBusy && page is not ("Create" or "Check" or "Text")) return; CurrentPage = page switch { "Check" => Check, + "Text" => Text, "Settings" => SettingsPage, "Update" => Update, "About" => About, diff --git a/src/HashTool.App/ViewModels/TextHashViewModel.cs b/src/HashTool.App/ViewModels/TextHashViewModel.cs new file mode 100644 index 0000000..0dd315f --- /dev/null +++ b/src/HashTool.App/ViewModels/TextHashViewModel.cs @@ -0,0 +1,154 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using HashTool.App.Services; +using Microsoft.Extensions.Logging; + +namespace HashTool.App.ViewModels; + +/// One algorithm's hash of the text on the "Hash Text" page. +public sealed partial class TextHashResult(HashType algorithm) : ObservableObject +{ + public HashType Algorithm { get; } = algorithm; + + [ObservableProperty] private string _hash = string.Empty; + + /// What screen readers call the hash box, such as "SHA256 hash". + [ObservableProperty] private string _hashName = string.Empty; + + /// What screen readers call the copy button, such as "Copy SHA256 hash". + [ObservableProperty] private string _copyName = string.Empty; +} + +/// A text encoding to choose from. Its name is the same in every language, like the algorithm names. +public sealed record TextEncodingOption(TextEncodingKind Kind) +{ + public string Name => TextHashing.DisplayName(Kind); + + public override string ToString() => Name; +} + +/// +/// The "Hash Text" page: the hash of typed or pasted text in every algorithm, recomputed shortly after each change. The +/// bytes hashed are exactly the text in the chosen encoding and line breaks (see ). +/// +public sealed partial class TextHashViewModel : ObservableObject +{ + private readonly HashEngine _engine; + private readonly SettingsService _settings; + private readonly IClipboardService _clipboard; + private readonly LocalizationService _localizationService; + private readonly ILogger _logger; + private CancellationTokenSource? _pending; + private long _byteCount; + + [ObservableProperty] private LocalizationProxy _localization; + [ObservableProperty] private string _text = string.Empty; + [ObservableProperty] private TextEncodingOption _selectedEncoding; + [ObservableProperty] private LineBreak _selectedLineBreak = LineBreak.Lf; + [ObservableProperty] private string _sizeText = string.Empty; + [ObservableProperty] private bool _isRevealed; + + public TextHashViewModel(HashEngine engine, SettingsService settings, IClipboardService clipboard, LocalizationService localization, + ILogger logger) + { + _engine = engine; + _settings = settings; + _clipboard = clipboard; + _localizationService = localization; + _logger = logger; + _localization = new LocalizationProxy(localization); + Encodings = Enum.GetValues().Select(kind => new TextEncodingOption(kind)).ToArray(); + _selectedEncoding = Encodings[0]; + Results = HashAlgorithms.All.Select(algorithm => new TextHashResult(algorithm)).ToArray(); + UpdateNames(); + + localization.LanguageChanged += (_, _) => + { + Localization = new LocalizationProxy(localization); + UpdateNames(); + }; + // The letter case of the hashes is a setting. + settings.Changed += (_, _) => Recompute(immediately: true); + Recompute(immediately: true); + } + + public IReadOnlyList Encodings { get; } + + public IReadOnlyList LineBreaks { get; } = Enum.GetValues(); + + /// One row per algorithm, in the order the other pages list them. + public IReadOnlyList Results { get; } + + /// How long to wait after a change before hashing, so typing does not hash every keystroke. + public TimeSpan Delay { get; set; } = TimeSpan.FromMilliseconds(150); + + /// The latest computation; tests wait for it. + internal Task Pending { get; private set; } = Task.CompletedTask; + + partial void OnTextChanged(string value) => Recompute(immediately: false); + + partial void OnSelectedEncodingChanged(TextEncodingOption value) => Recompute(immediately: true); + + partial void OnSelectedLineBreakChanged(LineBreak value) => Recompute(immediately: true); + + [RelayCommand] + private async Task CopyAsync(TextHashResult? result) + { + if (result is { Hash.Length: > 0 }) await _clipboard.SetTextAsync(result.Hash); + } + + private void Recompute(bool immediately) + { + _pending?.Cancel(); + _pending?.Dispose(); + _pending = new CancellationTokenSource(); + Pending = ComputeAsync(immediately ? TimeSpan.Zero : Delay, _pending.Token); + } + + private async Task ComputeAsync(TimeSpan delay, CancellationToken cancellationToken) + { + try + { + if (delay > TimeSpan.Zero) await Task.Delay(delay, cancellationToken); + var bytes = TextHashing.GetBytes(Text ?? string.Empty, SelectedEncoding.Kind, SelectedLineBreak); + var letterCase = _settings.Current.HashLetterCase; + var hashes = await Task.Run(async () => + { + using var stream = new MemoryStream(bytes, writable: false); + return await _engine.ComputeStreamAsync(stream, HashAlgorithms.All, cancellationToken: cancellationToken); + }, cancellationToken); + + cancellationToken.ThrowIfCancellationRequested(); + for (var i = 0; i < Results.Count; i++) Results[i].Hash = hashes[i].ToHex(letterCase); + _byteCount = bytes.LongLength; + UpdateSizeText(); + } + catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) + { + // A newer change replaced this computation. + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Hashing text failed"); + } + } + + private void UpdateNames() + { + foreach (var result in Results) + { + result.HashName = _localizationService.Format("Lbl_AlgorithmHash", result.Algorithm); + result.CopyName = _localizationService.Format("Tip_CopyAlgorithmHash", result.Algorithm); + } + + UpdateSizeText(); + } + + private void UpdateSizeText() => SizeText = _localizationService.Format("Lbl_TextSize", ByteSize.Format(_byteCount)); +} diff --git a/src/HashTool.App/Views/MainWindow.axaml b/src/HashTool.App/Views/MainWindow.axaml index 337ca56..091f22f 100644 --- a/src/HashTool.App/Views/MainWindow.axaml +++ b/src/HashTool.App/Views/MainWindow.axaml @@ -84,6 +84,13 @@ + + + + + + + + + diff --git a/src/HashTool.App/Views/TextHashView.axaml.cs b/src/HashTool.App/Views/TextHashView.axaml.cs new file mode 100644 index 0000000..0f88eb0 --- /dev/null +++ b/src/HashTool.App/Views/TextHashView.axaml.cs @@ -0,0 +1,17 @@ +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace HashTool.App.Views; + +public partial class TextHashView : UserControl +{ + public TextHashView() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } +} diff --git a/src/HashTool.Cli/HashCommand.cs b/src/HashTool.Cli/HashCommand.cs index e647da8..8338fea 100644 --- a/src/HashTool.Cli/HashCommand.cs +++ b/src/HashTool.Cli/HashCommand.cs @@ -16,11 +16,21 @@ namespace HashTool.Cli; /// hashtool hash: prints or writes checksum lines for files and folders. internal static class HashCommand { - private sealed record Input(string FullPath, string Display); + /// The path that stands for standard input, as in coreutils (a file named "-" is "./-"). + internal const string StandardInput = "-"; - public static Command Create(TextWriter output, TextWriter error) + private sealed record Input(string FullPath, string Display) { - var paths = new Argument("paths") { Description = "Files to hash (folders need --recursive).", Arity = ArgumentArity.OneOrMore }; + public bool IsStandardInput => FullPath == StandardInput; + } + + public static Command Create(TextWriter output, TextWriter error, Func openStandardInput) + { + var paths = new Argument("paths") + { + Description = "Files to hash (folders need --recursive; - reads standard input, e.g. printf '%s' text | hashtool hash -).", + Arity = ArgumentArity.OneOrMore + }; var algorithms = HashToolCommand.AlgorithmOption("Algorithm(s) to use: sha256 (default), sha1, md5, sha384, sha512, blake3, xxhash3, ..."); var recursive = new Option("--recursive", "-r") { Description = "Hash every file inside the given folders." }; var hidden = new Option("--hidden") { Description = "Include hidden and system files when walking folders." }; @@ -45,7 +55,7 @@ internal static class HashCommand result.GetValue(format), result.GetValue(outputFile), result.GetValue(upper) ? HexCase.Upper : HexCase.Lower, - result.GetValue(jobs)), output, error, cancellationToken)); + result.GetValue(jobs)), output, error, openStandardInput, cancellationToken)); return command; } @@ -59,7 +69,8 @@ internal static class HashCommand HexCase LetterCase, int Jobs); - internal static async Task RunAsync(Request request, TextWriter output, TextWriter error, CancellationToken cancellationToken) + internal static async Task RunAsync(Request request, TextWriter output, TextWriter error, Func openStandardInput, + CancellationToken cancellationToken) { var format = request.Format ?? (request.Algorithms.Count == 1 ? ExportFormat.Gnu : ExportFormat.Bsd); if (format == ExportFormat.Gnu && request.Algorithms.Count > 1) @@ -82,6 +93,7 @@ internal static class HashCommand var engine = new HashEngine(); var results = new HashResult[]?[inputs.Count]; var errors = new Exception?[inputs.Count]; + var sizes = new long?[inputs.Count]; var parallelism = request.Jobs > 0 ? request.Jobs : new BatchOptions().EffectiveParallelism; await Parallel.ForEachAsync(Enumerable.Range(0, inputs.Count), new ParallelOptions { MaxDegreeOfParallelism = parallelism, CancellationToken = cancellationToken }, @@ -89,7 +101,22 @@ internal static class HashCommand { try { - results[i] = await engine.ComputeFileAsync(inputs[i].FullPath, request.Algorithms, null, token).ConfigureAwait(false); + if (inputs[i].IsStandardInput) + { + long read = 0; + var stream = openStandardInput(); + await using (stream.ConfigureAwait(false)) + { + results[i] = await engine.ComputeStreamAsync(stream, request.Algorithms, n => read += n, token).ConfigureAwait(false); + } + + sizes[i] = read; + } + else + { + results[i] = await engine.ComputeFileAsync(inputs[i].FullPath, request.Algorithms, null, token).ConfigureAwait(false); + sizes[i] = SafeLength(inputs[i].FullPath); + } } catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { @@ -107,7 +134,7 @@ internal static class HashCommand continue; } - var size = SafeLength(inputs[i].FullPath); + var size = sizes[i]; lines.AddRange(results[i]!.Select(r => new ChecksumLine(inputs[i].Display, r.Algorithm, r.ToHex(request.LetterCase), size))); } @@ -138,8 +165,23 @@ internal static class HashCommand var seen = new HashSet(OperatingSystem.IsLinux() ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase); var options = new FileEnumerationOptions { IncludeHidden = request.IncludeHidden }; var errors = 0; + var readsStandardInput = false; foreach (var path in request.Paths) { + if (path == StandardInput) + { + if (readsStandardInput) + { + error.WriteLine("hashtool: -: standard input can be read only once"); + errors++; + continue; + } + + readsStandardInput = true; + inputs.Add(new Input(StandardInput, StandardInput)); + continue; + } + // Relative input stays relative in the output, like sha256sum; with --output it is relative to that file. var displayBase = relativeTo ?? (Path.IsPathRooted(path) ? null : Environment.CurrentDirectory); if (Directory.Exists(path)) diff --git a/src/HashTool.Cli/HashToolCommand.cs b/src/HashTool.Cli/HashToolCommand.cs index 4a95893..e01ba52 100644 --- a/src/HashTool.Cli/HashToolCommand.cs +++ b/src/HashTool.Cli/HashToolCommand.cs @@ -22,9 +22,14 @@ public static class HashToolCommand public const int Failure = 1; public const int UsageError = 2; - public static Task RunAsync(string[] args, TextWriter output, TextWriter error, CancellationToken cancellationToken = default) + public static Task RunAsync(string[] args, TextWriter output, TextWriter error, CancellationToken cancellationToken = default) => + RunAsync(args, output, error, Console.OpenStandardInput, cancellationToken); + + /// Runs a command line; supplies what hashtool hash - reads. + public static Task RunAsync(string[] args, TextWriter output, TextWriter error, Func openStandardInput, + CancellationToken cancellationToken = default) { - var parseResult = Build(output, error).Parse(args); + var parseResult = Build(output, error, openStandardInput).Parse(args); if (parseResult.Errors.Count > 0) { // Short message and exit code 2, like coreutils, instead of the full help text. @@ -36,10 +41,10 @@ public static class HashToolCommand return parseResult.InvokeAsync(new InvocationConfiguration { Output = output, Error = error }, cancellationToken); } - internal static RootCommand Build(TextWriter output, TextWriter error) + internal static RootCommand Build(TextWriter output, TextWriter error, Func openStandardInput) { var root = new RootCommand($"Hash Tool {Version} - compute and verify file hashes and checksum files (SHA256SUMS, .md5, .sfv...)."); - root.Subcommands.Add(HashCommand.Create(output, error)); + root.Subcommands.Add(HashCommand.Create(output, error, openStandardInput)); root.Subcommands.Add(VerifyCommand.Create(output, error)); root.Subcommands.Add(VerifyCommand.CreateCheck(output, error)); root.Subcommands.Add(CreateAlgorithmsCommand(output)); diff --git a/src/HashTool.Core/Hashing/TextHashing.cs b/src/HashTool.Core/Hashing/TextHashing.cs new file mode 100644 index 0000000..9042db7 --- /dev/null +++ b/src/HashTool.Core/Hashing/TextHashing.cs @@ -0,0 +1,89 @@ +using System; +using System.Text; + +namespace HashTool.Core.Hashing; + +/// Character encodings text can be hashed in. None of them writes a byte order mark. +public enum TextEncodingKind +{ + Utf8, + Utf16LittleEndian, + Utf16BigEndian +} + +/// How line breaks are written into the bytes that are hashed. +public enum LineBreak +{ + /// LF, as on Linux and macOS (and in printf output). + Lf, + + /// CR LF, as in Windows text files. + CrLf +} + +/// +/// Turns text into the exact bytes that get hashed: every line break (CR LF, CR or LF) written as the chosen one, the +/// chosen encoding without a byte order mark, and nothing added at the end. The same text therefore hashes the same on +/// every platform, whatever the text box inserts for Enter. +/// +public static class TextHashing +{ + private static readonly UTF8Encoding Utf8 = new(encoderShouldEmitUTF8Identifier: false); + private static readonly UnicodeEncoding Utf16LittleEndian = new(bigEndian: false, byteOrderMark: false); + private static readonly UnicodeEncoding Utf16BigEndian = new(bigEndian: true, byteOrderMark: false); + + public static byte[] GetBytes(string text, TextEncodingKind encoding, LineBreak lineBreak) + { + ArgumentNullException.ThrowIfNull(text); + return GetEncoding(encoding).GetBytes(NormalizeLineBreaks(text, lineBreak)); + } + + public static Encoding GetEncoding(TextEncodingKind encoding) => encoding switch + { + TextEncodingKind.Utf8 => Utf8, + TextEncodingKind.Utf16LittleEndian => Utf16LittleEndian, + TextEncodingKind.Utf16BigEndian => Utf16BigEndian, + _ => throw new ArgumentOutOfRangeException(nameof(encoding), encoding, "Unknown text encoding.") + }; + + /// Display name of an encoding, the same in every language (like the algorithm names). + public static string DisplayName(TextEncodingKind encoding) => encoding switch + { + TextEncodingKind.Utf8 => "UTF-8", + TextEncodingKind.Utf16LittleEndian => "UTF-16 LE", + TextEncodingKind.Utf16BigEndian => "UTF-16 BE", + _ => throw new ArgumentOutOfRangeException(nameof(encoding), encoding, "Unknown text encoding.") + }; + + /// + /// Writes CR LF, a lone CR and a lone LF as . Unlike , + /// other characters Unicode counts as line separators (form feed, NEL, U+2028, U+2029) are kept as they are. + /// + public static string NormalizeLineBreaks(string text, LineBreak lineBreak) + { + ArgumentNullException.ThrowIfNull(text); + if (text.AsSpan().IndexOfAny('\r', '\n') < 0) return text; + + var newLine = lineBreak == LineBreak.CrLf ? "\r\n" : "\n"; + var builder = new StringBuilder(text.Length + 16); + for (var i = 0; i < text.Length; i++) + { + var c = text[i]; + if (c == '\r') + { + builder.Append(newLine); + if (i + 1 < text.Length && text[i + 1] == '\n') i++; + } + else if (c == '\n') + { + builder.Append(newLine); + } + else + { + builder.Append(c); + } + } + + return builder.ToString(); + } +} diff --git a/tests/HashTool.App.Tests/AccessibilityTests.cs b/tests/HashTool.App.Tests/AccessibilityTests.cs index 60161fc..b3a6de9 100644 --- a/tests/HashTool.App.Tests/AccessibilityTests.cs +++ b/tests/HashTool.App.Tests/AccessibilityTests.cs @@ -30,7 +30,7 @@ namespace HashTool.App.Tests; [Collection(SharedStateCollection.Name)] public sealed class AccessibilityTests { - private static readonly string[] Pages = ["Create", "Check", "Settings", "Update", "About", "Developer"]; + private static readonly string[] Pages = ["Create", "Check", "Text", "Settings", "Update", "About", "Developer"]; /// A shown main window with two files on Generate and Verify; cleans up after itself. private sealed class Screen : IAsyncDisposable diff --git a/tests/HashTool.App.Tests/MainWindowViewModelTests.cs b/tests/HashTool.App.Tests/MainWindowViewModelTests.cs index 33c27c1..e72f3e9 100644 --- a/tests/HashTool.App.Tests/MainWindowViewModelTests.cs +++ b/tests/HashTool.App.Tests/MainWindowViewModelTests.cs @@ -10,6 +10,7 @@ using HashTool.App.Services; using HashTool.App.Services.Theme; using HashTool.App.ViewModels; using HashTool.Core.Configuration; +using HashTool.Core.Hashing; using HashTool.Core.Tests; using Microsoft.Extensions.Logging; using Xunit; @@ -27,6 +28,8 @@ internal sealed class MainPage : IDisposable var services = TestServices.Create(Dialogs, Storage, Clipboard, Settings); Create = new CreateHashViewModel(services); Check = new CheckHashViewModel(services); + Text = new TextHashViewModel(new HashEngine(), Settings, Clipboard, TestServices.Localization, + TestServices.Loggers.CreateLogger()); Theme = new ThemeService(); var fonts = new FontService(TestServices.Loggers.CreateLogger()); var notInstalled = new UpdateService(TestServices.Loggers.CreateLogger(), null, new System.Net.Http.HttpClient()); @@ -35,7 +38,7 @@ internal sealed class MainPage : IDisposable Update = new UpdateViewModel(notInstalled, Settings, TestServices.Localization, Launcher, TestServices.Loggers.CreateLogger()); Developer = new DeveloperViewModel(new LogSink(PathSanitizer.Shared), TestServices.Localization, Clipboard, Storage, Launcher); Activation = new ActivationService(TestServices.Loggers.CreateLogger()); - Vm = new MainWindowViewModel(Create, Check, SettingsPage, Update, new AboutViewModel(notInstalled, TestServices.Localization, Launcher), + Vm = new MainWindowViewModel(Create, Check, Text, SettingsPage, Update, new AboutViewModel(notInstalled, TestServices.Localization, Launcher), Developer, Settings, TestServices.Localization, fonts, Theme, Activation); } @@ -55,6 +58,8 @@ internal sealed class MainPage : IDisposable public CheckHashViewModel Check { get; } + public TextHashViewModel Text { get; } + public ThemeService Theme { get; } public SettingsViewModel SettingsPage { get; } @@ -83,7 +88,7 @@ public sealed class MainWindowViewModelTests foreach (var (name, expected) in new (string, object)[] { - ("Check", page.Check), ("Settings", page.SettingsPage), ("Update", page.Update), ("About", page.Vm.About), + ("Check", page.Check), ("Text", page.Text), ("Settings", page.SettingsPage), ("Update", page.Update), ("About", page.Vm.About), ("Developer", page.Developer), ("Create", page.Create), ("Unknown", page.Create) }) { @@ -104,6 +109,8 @@ public sealed class MainWindowViewModelTests Assert.Same(page.Create, page.Vm.CurrentPage); page.Vm.NavigateCommand.Execute("Check"); Assert.Same(page.Check, page.Vm.CurrentPage); + page.Vm.NavigateCommand.Execute("Text"); + Assert.Same(page.Text, page.Vm.CurrentPage); page.Create.IsBusy = false; page.Vm.ShowUpdateCommand.Execute(null); diff --git a/tests/HashTool.App.Tests/TextHashViewModelTests.cs b/tests/HashTool.App.Tests/TextHashViewModelTests.cs new file mode 100644 index 0000000..0a82fc4 --- /dev/null +++ b/tests/HashTool.App.Tests/TextHashViewModelTests.cs @@ -0,0 +1,136 @@ +using System; +using System.Linq; +using System.Security.Cryptography; +using System.Threading.Tasks; +using Avalonia.Headless.XUnit; +using HashTool.App.Services; +using HashTool.App.ViewModels; +using HashTool.Core; +using HashTool.Core.Hashing; +using HashTool.Core.Tests; +using Microsoft.Extensions.Logging; +using Xunit; + +namespace HashTool.App.Tests; + +/// A "Hash Text" page of its own, with its own settings and clipboard; it hashes without waiting. +internal sealed class TextPage : IDisposable +{ + public TextPage() + { + Settings = TestServices.Settings(System.IO.Path.Combine(Temp.Path, ".settings")); + Vm = new TextHashViewModel(new HashEngine(), Settings, Clipboard, TestServices.Localization, + TestServices.Loggers.CreateLogger()) + { Delay = TimeSpan.Zero }; + } + + public TempDirectory Temp { get; } = new(); + + public SettingsService Settings { get; } + + public RecordingClipboard Clipboard { get; } = new(); + + public TextHashViewModel Vm { get; } + + public string HashOf(HashType type) => Vm.Results.Single(r => r.Algorithm == type).Hash; + + public async Task TypeAsync(string text) + { + Vm.Text = text; + await Vm.Pending; + } + + public void Dispose() + { + Settings.Dispose(); + Temp.Dispose(); + } +} + +public sealed class TextHashViewModelTests +{ + private static string Sha256(byte[] bytes) => Convert.ToHexString(SHA256.HashData(bytes)); + + [AvaloniaFact] + public async Task ListsEveryAlgorithm_StartingWithTheHashesOfNoText() + { + using var page = new TextPage(); + await page.Vm.Pending; + + Assert.Equal(HashAlgorithms.All, page.Vm.Results.Select(r => r.Algorithm)); + Assert.Equal("E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", page.HashOf(HashType.SHA256)); + Assert.Equal(TestServices.Localization.Format("Lbl_TextSize", ByteSize.Format(0)), page.Vm.SizeText); + } + + [AvaloniaFact] + public async Task HashesTheTypedText_WithEveryAlgorithm() + { + using var page = new TextPage(); + + await page.TypeAsync("abc"); + + Assert.Equal("BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD", page.HashOf(HashType.SHA256)); + Assert.Equal("900150983CD24FB0D6963F7D28E17F72", page.HashOf(HashType.MD5)); + Assert.Equal("6437B3AC38465133FFB63B75273A8DB548C558465D79DB03FD359C6CD5BD9D85", page.HashOf(HashType.BLAKE3)); + Assert.Equal("352441C2", page.HashOf(HashType.CRC32)); + Assert.All(page.Vm.Results, r => Assert.False(string.IsNullOrEmpty(r.Hash))); + Assert.Equal(TestServices.Localization.Format("Lbl_TextSize", ByteSize.Format(3)), page.Vm.SizeText); + } + + [AvaloniaFact] + public async Task EncodingAndLineBreaks_ChangeTheBytesThatAreHashed() + { + using var page = new TextPage(); + await page.TypeAsync("a\r\nb"); + Assert.Equal(Sha256("a\nb"u8.ToArray()), page.HashOf(HashType.SHA256)); + + page.Vm.SelectedLineBreak = LineBreak.CrLf; + await page.Vm.Pending; + Assert.Equal(Sha256("a\r\nb"u8.ToArray()), page.HashOf(HashType.SHA256)); + + page.Vm.SelectedEncoding = page.Vm.Encodings.Single(e => e.Kind == TextEncodingKind.Utf16LittleEndian); + await page.Vm.Pending; + Assert.Equal(Sha256([0x61, 0, 0x0D, 0, 0x0A, 0, 0x62, 0]), page.HashOf(HashType.SHA256)); + Assert.Equal(new[] { "UTF-8", "UTF-16 LE", "UTF-16 BE" }, page.Vm.Encodings.Select(e => e.ToString())); + } + + [AvaloniaFact] + public async Task FollowsTheLetterCaseSetting() + { + using var page = new TextPage(); + page.Settings.Update(s => s.HashLetterCase = HexCase.Lower); + await page.TypeAsync("abc"); + + Assert.Equal("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", page.HashOf(HashType.SHA256)); + } + + [AvaloniaFact] + public async Task TypingQuickly_HashesOnlyTheLatestText() + { + using var page = new TextPage(); + page.Vm.Delay = TimeSpan.FromMilliseconds(50); + + page.Vm.Text = "a"; + page.Vm.Text = "ab"; + page.Vm.Text = "abc"; + await page.Vm.Pending; + + Assert.Equal("BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD", page.HashOf(HashType.SHA256)); + } + + [AvaloniaFact] + public async Task Copy_PutsTheWholeHashOnTheClipboard_AndEveryRowIsNamed() + { + using var page = new TextPage(); + await page.TypeAsync("abc"); + var sha256 = page.Vm.Results.Single(r => r.Algorithm == HashType.SHA256); + + await page.Vm.CopyCommand.ExecuteAsync(sha256); + await page.Vm.CopyCommand.ExecuteAsync(null); + + Assert.Equal(new[] { "BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD" }, page.Clipboard.Texts); + Assert.Equal(TestServices.Localization.Format("Lbl_AlgorithmHash", HashType.SHA256), sha256.HashName); + Assert.Equal(TestServices.Localization.Format("Tip_CopyAlgorithmHash", HashType.SHA256), sha256.CopyName); + Assert.All(page.Vm.Results, r => Assert.Contains(r.Algorithm.ToString(), r.HashName, StringComparison.Ordinal)); + } +} diff --git a/tests/HashTool.Cli.Tests/CliTests.cs b/tests/HashTool.Cli.Tests/CliTests.cs index 618c9d1..72d35ac 100644 --- a/tests/HashTool.Cli.Tests/CliTests.cs +++ b/tests/HashTool.Cli.Tests/CliTests.cs @@ -26,6 +26,20 @@ public sealed class CliTests : IDisposable return (exitCode, output.ToString(), error.ToString()); } + /// Runs with as standard input; counts how often it is opened. + private static async Task<(int ExitCode, string Output, string Error, int Opened)> RunWithInputAsync(string input, params string[] args) + { + using var output = new StringWriter { NewLine = "\n" }; + using var error = new StringWriter { NewLine = "\n" }; + var opened = 0; + var exitCode = await HashToolCommand.RunAsync(args, output, error, () => + { + opened++; + return new MemoryStream(System.Text.Encoding.UTF8.GetBytes(input), writable: false); + }, TestContext.Current.CancellationToken); + return (exitCode, output.ToString(), error.ToString(), opened); + } + [Fact] public async Task Hash_SingleFile_PrintsGnuLine() { @@ -38,6 +52,50 @@ public sealed class CliTests : IDisposable Assert.Empty(error); } + [Fact] + public async Task Hash_Dash_ReadsStandardInput() + { + var (exitCode, output, error, opened) = await RunWithInputAsync("hello", "hash", "-"); + + Assert.Equal(0, exitCode); + Assert.Equal($"{Sha256OfHello} -\n", output); + Assert.Empty(error); + Assert.Equal(1, opened); + } + + [Fact] + public async Task Hash_Dash_WorksWithFilesAndSeveralAlgorithms() + { + var file = _temp.File("check.txt", "123456789"); + + var (exitCode, output, _, _) = await RunWithInputAsync("123456789", "hash", "-a", "sha256,crc32", file, "-"); + + Assert.Equal(0, exitCode); + Assert.Contains($"SHA256 (-) = {Sha256Of123456789}", output, StringComparison.OrdinalIgnoreCase); + Assert.Contains("CRC32 (-) = CBF43926", output, StringComparison.OrdinalIgnoreCase); + Assert.Contains($"SHA256 ({Shown(file)}) = {Sha256Of123456789}", output, StringComparison.OrdinalIgnoreCase); + } + + [Fact] + public async Task Hash_Dash_JsonReportsTheBytesRead() + { + var (exitCode, output, _, _) = await RunWithInputAsync("hello", "hash", "-f", "json", "-"); + + Assert.Equal(0, exitCode); + Assert.Contains("\"size\": 5", output, StringComparison.Ordinal); + } + + [Fact] + public async Task Hash_DashTwice_ReadsStandardInputOnce() + { + var (exitCode, output, error, opened) = await RunWithInputAsync("hello", "hash", "-", "-"); + + Assert.Equal(1, exitCode); + Assert.Equal($"{Sha256OfHello} -\n", output); + Assert.Contains("standard input can be read only once", error, StringComparison.Ordinal); + Assert.Equal(1, opened); + } + [Fact] public async Task Hash_SeveralAlgorithms_UsesTaggedFormat() { diff --git a/tests/HashTool.Core.Tests/Hashing/TextHashingTests.cs b/tests/HashTool.Core.Tests/Hashing/TextHashingTests.cs new file mode 100644 index 0000000..53e4ce4 --- /dev/null +++ b/tests/HashTool.Core.Tests/Hashing/TextHashingTests.cs @@ -0,0 +1,79 @@ +using System; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using HashTool.Core.Hashing; +using Xunit; + +namespace HashTool.Core.Tests.Hashing; + +public sealed class TextHashingTests +{ + [Fact] + public void Utf8_HasNoByteOrderMarkAndNothingAddedAtTheEnd() + { + Assert.Equal("abc"u8.ToArray(), TextHashing.GetBytes("abc", TextEncodingKind.Utf8, LineBreak.Lf)); + Assert.Equal("é€"u8.ToArray(), TextHashing.GetBytes("é€", TextEncodingKind.Utf8, LineBreak.Lf)); + Assert.Empty(TextHashing.GetBytes("", TextEncodingKind.Utf8, LineBreak.Lf)); + } + + [Fact] + public void Utf16_IsWrittenInTheChosenByteOrderWithoutAByteOrderMark() + { + Assert.Equal(new byte[] { 0x61, 0, 0x62, 0, 0x63, 0 }, TextHashing.GetBytes("abc", TextEncodingKind.Utf16LittleEndian, LineBreak.Lf)); + Assert.Equal(new byte[] { 0, 0x61, 0, 0x62, 0, 0x63 }, TextHashing.GetBytes("abc", TextEncodingKind.Utf16BigEndian, LineBreak.Lf)); + } + + [Theory] + [InlineData("a\r\nb\rc\nd", LineBreak.Lf, "a\nb\nc\nd")] + [InlineData("a\r\nb\rc\nd", LineBreak.CrLf, "a\r\nb\r\nc\r\nd")] + [InlineData("a\n\nb\r\n", LineBreak.CrLf, "a\r\n\r\nb\r\n")] + [InlineData("a\r\r\nb", LineBreak.Lf, "a\n\nb")] + [InlineData("no line breaks", LineBreak.CrLf, "no line breaks")] + public void LineBreaks_AreWrittenAsChosen(string text, LineBreak lineBreak, string expected) => + Assert.Equal(expected, TextHashing.NormalizeLineBreaks(text, lineBreak)); + + [Fact] + public void OtherUnicodeSeparators_AreKept() + { + // Form feed, NEL and the Unicode line and paragraph separators are text, not line breaks of the text box. + var text = string.Concat("a", char.ConvertFromUtf32(0x0C), "b", char.ConvertFromUtf32(0x85), "c", char.ConvertFromUtf32(0x2028), "d", + char.ConvertFromUtf32(0x2029), "e"); + + Assert.Equal(text, TextHashing.NormalizeLineBreaks(text, LineBreak.CrLf)); + } + + [Theory] + [InlineData(TextEncodingKind.Utf8, "UTF-8")] + [InlineData(TextEncodingKind.Utf16LittleEndian, "UTF-16 LE")] + [InlineData(TextEncodingKind.Utf16BigEndian, "UTF-16 BE")] + public void Encodings_HaveTheirUsualNames(TextEncodingKind encoding, string name) => + Assert.Equal(name, TextHashing.DisplayName(encoding)); + + [Fact] + public void UnknownValues_AreRejected() + { + Assert.Throws(() => TextHashing.GetEncoding((TextEncodingKind)42)); + Assert.Throws(() => TextHashing.DisplayName((TextEncodingKind)42)); + Assert.Throws(() => TextHashing.GetBytes(null!, TextEncodingKind.Utf8, LineBreak.Lf)); + } + + [Fact] + public async Task TextHashes_MatchTheHashesOfAFileWithTheSameBytes() + { + using var temp = new TempDirectory(); + var engine = new HashEngine(); + var token = TestContext.Current.CancellationToken; + const string text = "Hash Tool\r\nsecond line\nthird ✓"; + var bytes = TextHashing.GetBytes(text, TextEncodingKind.Utf8, LineBreak.Lf); + var file = temp.File("text.txt", bytes); + + using var memory = new MemoryStream(bytes, writable: false); + var fromText = await engine.ComputeStreamAsync(memory, HashAlgorithms.All, cancellationToken: token); + var fromFile = await engine.ComputeFileAsync(file, HashAlgorithms.All, cancellationToken: token); + + Assert.Equal(fromFile.Select(r => r.ToHex()), fromText.Select(r => r.ToHex())); + Assert.Equal("BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD", + (await engine.ComputeStreamAsync(new MemoryStream("abc"u8.ToArray()), [HashType.SHA256], cancellationToken: token))[0].ToHex()); + } +}