
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
wasm-hash-module
Advanced tools
A high-performance WebAssembly module providing multiple fast hash functions optimized for web applications. Built with Rust and compiled to WebAssembly for maximum speed and compatibility.
A high-performance WebAssembly module providing multiple fast hash functions optimized for web applications. Built with Rust and compiled to WebAssembly for maximum speed and compatibility.
# Install Rust and wasm-pack
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# Clone and build
git clone <your-repo>
cd wasm-hash-module
# Standard build (recommended)
wasm-pack build --target web --release
# With debug features
wasm-pack build --target web --release -- --features "console_error_panic_hook"
# Size-optimized build
wasm-pack build --target web --release
wasm-opt pkg/wasm_hash_module_bg.wasm -O4 -o pkg/wasm_hash_module_bg.wasm
# Copy the generated pkg/ directory to your project
cp -r pkg/ your-project/wasm-hash-module/
# Or publish to npm and install
npm install wasm-hash-module
import init, {
xxh3_hash,
wyhash,
museair_hash,
string_to_bytes,
OutputFormat
} from './pkg/wasm_hash_module.js';
// Initialize the module
await init();
// Hash a string
const data = string_to_bytes("Hello, World!");
// Get hashes in different formats
console.log("XXH3 (Hex):", xxh3_hash(data, OutputFormat.Hex));
console.log("XXH3 (Base58):", xxh3_hash(data, OutputFormat.Base58));
console.log("XXH3 (Base64):", xxh3_hash(data, OutputFormat.Base64));
console.log("WyHash:", wyhash(data, OutputFormat.Hex));
console.log("MuseAir:", museair_hash(data, OutputFormat.Hex));
import { XXH3Hasher } from './pkg/wasm_hash_module.js';
// Stream processing for large files
const hasher = new XXH3Hasher();
hasher.update(chunk1);
hasher.update(chunk2);
hasher.update(chunk3);
const finalHash = hasher.finalize(OutputFormat.Hex);
async function hashFile(file) {
const reader = new FileReader();
return new Promise((resolve) => {
reader.onload = (e) => {
const bytes = new Uint8Array(e.target.result);
const hash = xxh3_hash(bytes, OutputFormat.Hex);
resolve(hash);
};
reader.readAsArrayBuffer(file);
});
}
// Usage
const fileHash = await hashFile(document.getElementById('file').files[0]);
import { benchmark_hash_function, compare_all_hashes } from './pkg/wasm_hash_module.js';
const testData = string_to_bytes("A".repeat(1000)); // 1KB test data
// Benchmark each algorithm
console.log("XXH3:", benchmark_hash_function(testData, "xxh3", 10000), "ms");
console.log("WyHash:", benchmark_hash_function(testData, "wyhash", 10000), "ms");
console.log("MuseAir:", benchmark_hash_function(testData, "museair", 10000), "ms");
// Compare all algorithms on same data
const comparison = compare_all_hashes(testData, OutputFormat.Hex);
console.log("All hashes:", comparison.xxh3, comparison.wyhash, comparison.museair);
xxh3_hash(data: Uint8Array, format: OutputFormat) → stringCompute XXH3 64-bit hash.
xxh3_128_hash(data: Uint8Array, format: OutputFormat) → stringCompute XXH3 128-bit hash (more collision-resistant).
xxh3_hash_with_seed(data: Uint8Array, seed: bigint, format: OutputFormat) → stringCompute XXH3 hash with custom seed.
wyhash(data: Uint8Array, format: OutputFormat) → stringCompute WyHash (ultra-fast, good distribution).
wyhash_with_seed(data: Uint8Array, seed: bigint, format: OutputFormat) → stringCompute WyHash with custom seed.
museair_hash(data: Uint8Array, format: OutputFormat) → stringCompute MuseAir hash (modern, high-quality).
museair_hash_with_seed(data: Uint8Array, seed: bigint, format: OutputFormat) → stringCompute MuseAir hash with custom seed.
XXH3Hasherconst hasher = new XXH3Hasher(); // Default constructor
const hasher = new XXH3Hasher(seed); // With seed
hasher.update(data); // Add data
const hash = hasher.finalize(format); // Get result
hasher.reset(); // Reset for reuse
string_to_bytes(input: string) → Uint8ArrayConvert string to bytes for hashing.
hex_to_bytes(hex: string) → Uint8ArrayConvert hex string to bytes.
compare_all_hashes(data: Uint8Array, format: OutputFormat) → HashComparisonGet all three hash results in one call.
benchmark_hash_function(data: Uint8Array, algorithm: string, iterations: number) → numberBenchmark performance (returns milliseconds).
OutputFormat.Hex // "a1b2c3d4..."
OutputFormat.Base58 // "2NEpo7TZR..."
OutputFormat.Base64 // "YWJjZGVm..."
# Web (ES modules)
wasm-pack build --target web
# Node.js
wasm-pack build --target nodejs
# Bundler (Webpack, Rollup, etc.)
wasm-pack build --target bundler
[features]
default = []
console_error_panic_hook = ["dep:console_error_panic_hook"] # Debug builds
The module is optimized for:
opt-level = "s"--experimental-wasm-modulesRun included benchmarks:
// Test with your data
const myData = string_to_bytes("Your test data here");
console.log("Performance:", benchmark_hash_function(myData, "xxh3", 1000));
cargo testwasm-pack build --target web# Install dev dependencies
cargo install wasm-pack
npm install -g serve # For testing
# Run tests
cargo test
wasm-pack test --headless --firefox
MIT License - see LICENSE file for details.
Built with ❤️ using Rust + WebAssembly
FAQs
A high-performance WebAssembly module providing multiple fast hash functions optimized for web applications. Built with Rust and compiled to WebAssembly for maximum speed and compatibility.
We found that wasm-hash-module demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.