mazipan / mazipan/html-tools

feat: add Hash Generator tool

Open
#126 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Summary

Add a hash.html tool that computes cryptographic hashes (SHA-256, SHA-512, SHA-1) for text or files entirely in the browser using the native WebCrypto API.

Motivation

File integrity checks and quick hash comparisons are common developer tasks. The WebCrypto SubtleCrypto.digest() API covers the most-needed algorithms with no external library, keeping the bundle tiny and the UX instant. MD5, while not in WebCrypto, can be inlined as a ~100-line pure-JS implementation for users who still need it for legacy compatibility checks.

Proposed UX

  • Input: textarea for text OR a file drop-zone (drag a file → hash its bytes)
  • Algorithm pills: MD5 · SHA-1 · SHA-256 · SHA-512 — all computed on every input change, shown simultaneously
  • Output: each hash displayed as a hex string with a copy button; uppercase/lowercase toggle
  • Compare mode: a second input to paste an expected hash — green ✓ / red ✗ match indicator per algorithm row
  • File size and name shown when a file is loaded; "Clear" resets to text mode

Implementation notes

  • Category: Code
  • Slug: hash
  • Icon: #️⃣
  • SHA-1 / SHA-256 / SHA-512 via window.crypto.subtle.digest() — no library
  • MD5 inlined as a minimal pure-JS implementation (~100 lines) since it is absent from WebCrypto
  • ArrayBuffer → hex via Uint8Array + .toString(16).padStart(2, '0') join
  • File hashing via FileReader.readAsArrayBuffer
  • All logic inline in <script>
  • Follow src/_tool-template.html and run bun run generate:sections, bun run generate:index, bun run generate:favicon after adding to tools.json

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/_tool-template.html and the existing entries in tools.json to understand the tool structure, then review the generation commands listed in the issue. The work is complete when hash.html supports text and file hashing, all four algorithms, copying, case toggling, comparison, file metadata, and Clear behavior, with generated sections, index, and favicon updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
tooling, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.