Skip to content
BEAD

Hashing Snippet Generator

MD5 / SHA-1 / SHA-256 / SHA-512 / HMAC-SHA256 snippets in Node, browser, Python, PHP, Ruby, Go, Rust, and shell.

Node.js (crypto)
import { createHash } from "node:crypto";
const hash = createHash("sha256").update("hello world").digest("hex");
console.log(hash);
Browser (Web Crypto)
const data = new TextEncoder().encode("hello world");
const buf = await crypto.subtle.digest("SHA-256", data);
const hex = Array.from(new Uint8Array(buf)).map(b => b.toString(16).padStart(2, "0")).join("");
console.log(hex);  // browser has no built-in MD5 / SHA-1 hex helper — this works for SHA-256/512
Python (hashlib / hmac)
import hashlib
print(hashlib.sha256("hello world".encode()).hexdigest())
PHP
<?php
echo hash("sha256", "hello world");
Ruby (OpenSSL::Digest)
require "digest"
puts Digest::SHA256.hexdigest("hello world")
Go (crypto/...)
package main

import (
	"crypto/sha256"
	"encoding/hex"
	"fmt"
)

func main() {
	sum := sha256.Sum256([]byte("hello world"))
	fmt.Println(hex.EncodeToString(sum[:]))
}
Rust (sha2 / hmac)
// Cargo: sha2 = "...", hex = "0.4"
use sha2::{Digest, Sha256};

fn main() {
    let mut hasher = Sha256::new();
    hasher.update("hello world".as_bytes());
    println!("{}", hex::encode(hasher.finalize()));
}
Shell (openssl)
printf %s 'hello world' | sha256sum
</>Use this tool programmaticallycurl · JavaScript · MCP

Same tool, callable from any HTTP client or from Claude (via MCP). Anonymous: 100 req/day per IP. Sign up for 1,000 req/day.

curl
curl https://api.b-e-a-d.com/tools/hash-snippet-generator/run \
  -H "Content-Type: application/json" \
  -d '{
  "algo": "md5",
  "message": "a",
  "key": ""
}'
JavaScript (fetch)
const res = await fetch("https://api.b-e-a-d.com/tools/hash-snippet-generator/run", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "algo": "md5",
  "message": "a",
  "key": ""
}),
});
const data = await res.json();
console.log(data.result);
MCP (Claude Desktop / Claude Code)
# In Claude Desktop / Claude Code, add to your MCP config:
{
  "mcpServers": {
    "bead": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.b-e-a-d.com"]
    }
  }
}

# Then ask Claude to call:
mcp__bead__bead_hash_snippet_generator

Full reference: developer docs · OpenAPI spec

What you get

Pick an algorithm (MD5, SHA-1, SHA-256, SHA-512, or HMAC-SHA256) and copy the equivalent snippet in eight languages — Node, browser, Python, PHP, Ruby, Go, Rust, and shell.

HMAC

For HMAC variants, the secret key field is interpolated into each snippet alongside the message. Keep secrets out of code in production — these snippets are for prototyping or doc copy.

You might also like