mirror of
https://github.com/multipleof4/SpeckHashX.git
synced 2026-11-18 15:42:51 +00:00
main
The site had no robots.txt, sitemap.xml or 404.html, so Cloudflare Pages answered every path, including /robots.txt, with the home page and a 200. The three files now exist, and unknown paths get a real 404. The 404 page is a second Vite entry so it shares the site's stylesheet. The homepage field of the crate and of the npm package now point at the site. No versions change and nothing is published. Model: Anthropic claude-fable-5-2 Prompt Gist: does speckhashx website allow robots.txt and also show itself on google correctly? [the answer suggested: 1. add robots.txt, sitemap.xml and 404.html to the site, 2. link the site from the README and the npm and Cargo homepage fields] do 1 and 2 but dont publish the packages just push the repo. altho dont add the site to the readme its already in repo url just add to package homepage fields but dont publish. also use vibegif in the 404
SpeckHashX
A hash function with any output length, built from the Speck128/256 block cipher. One Rust source produces both the Rust crate and the WebAssembly npm package.
Experimental. This design is new and has not been reviewed by anyone.
Use
Rust (cargo add speckhashx):
let h = speckhashx::hash(b"abc", 32); // Vec<u8> of 32 bytes
let mut s = speckhashx::Hasher::new(32);
s.update(b"ab").update(b"c");
assert_eq!(s.finalize(), h);
JavaScript (npm i speckhashx; works in Node, Bun and browsers):
import { hash, hex, Hasher } from 'speckhashx'
hex('abc') // 'f9d38f0c372695b6…', 32 bytes by default
hex('abc', 16) // 'dbfecc39d9de1f99…', 16 bytes
hash(bytes, 64) // Uint8Array of 64 bytes
new Hasher(32).update('ab').update('c').digest()
The number is the output length in bytes; in JavaScript it is optional and defaults to 32.
Strings are hashed as UTF-8, and an ArrayBuffer, typed array or DataView as its bytes;
anything else throws. Hashes of different output lengths are unrelated:
a 16-byte hash is not the start of the 32-byte hash of the same message.
Test vectors
Output is 32 bytes unless noted.
| Message | Hash |
|---|---|
| empty | 2353e9fb3e8415144a2ba616b57448957d0a72c4003fd759e6bf96e6a3b57317 |
abc |
f9d38f0c372695b67d5c06c25421beaede279d9a6da9422cfecfa18e638e96f3 |
abc, 16-byte output |
dbfecc39d9de1f993d00a90030e89294 |
The quick brown fox jumps over the lazy dog |
edb6137d9032d6a8e607754a0a29e18702b578d512d119a9f249f5bb4f6ac353 |
License
CC0 1.0: public domain, the same terms as Speck itself.
Languages
Rust
41%
JavaScript
24.4%
HTML
17.9%
CSS
16.7%