API & Embed Widgets

Integrate our tools into your website or app

JavaScript Functions

Use these functions directly in your JavaScript code. All processing happens client-side.

Base64 Encode/Decode

Convert text to Base64 and back.

// Base64 Encode
function base64Encode(text) {
  return btoa(unescape(encodeURIComponent(text)));
}

// Base64 Decode
function base64Decode(encoded) {
  return decodeURIComponent(escape(atob(encoded)));
}

// Usage
const encoded = base64Encode("Hello World");
console.log(encoded); // Output: "SGVsbG8gV29ybGQ="

const decoded = base64Decode(encoded);
console.log(decoded); // Output: "Hello World"

MD5 Hash

Generate MD5 hash using CryptoJS library.

// Include CryptoJS first:
// <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>

function md5Hash(text) {
  return CryptoJS.MD5(text).toString();
}

// Usage
const hash = md5Hash("Hello World");
console.log(hash); // Output: "b10a8db164e0754105b7a99be72e3fe5"

SHA-256 Hash

Generate SHA-256 hash using Web Crypto API.

async function sha256Hash(text) {
  const encoder = new TextEncoder();
  const data = encoder.encode(text);
  const hashBuffer = await crypto.subtle.digest('SHA-256', data);
  const hashArray = Array.from(new Uint8Array(hashBuffer));
  return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}

// Usage
sha256Hash("Hello World").then(hash => {
  console.log(hash);
  // Output: "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"
});

Hex Encode/Decode

Convert text to hexadecimal and back.

// Hex Encode
function hexEncode(text) {
  return Array.from(text)
    .map(c => c.charCodeAt(0).toString(16).padStart(2, '0'))
    .join(' ');
}

// Hex Decode
function hexDecode(hex) {
  return hex.split(' ')
    .map(h => String.fromCharCode(parseInt(h, 16)))
    .join('');
}

// Usage
const encoded = hexEncode("Hello");
console.log(encoded); // Output: "48 65 6c 6c 6f"

const decoded = hexDecode("48 65 6c 6c 6f");
console.log(decoded); // Output: "Hello"

Binary Encode/Decode

Convert text to binary and back.

// Binary Encode
function binaryEncode(text) {
  return Array.from(text)
    .map(c => c.charCodeAt(0).toString(2).padStart(8, '0'))
    .join(' ');
}

// Binary Decode
function binaryDecode(binary) {
  return binary.split(' ')
    .map(b => String.fromCharCode(parseInt(b, 2)))
    .join('');
}

// Usage
const encoded = binaryEncode("Hi");
console.log(encoded); // Output: "01001000 01101001"

const decoded = binaryDecode("01001000 01101001");
console.log(decoded); // Output: "Hi"

Embed Our Tools

Add our tools directly to your website using an iframe.

<iframe 
  src="https://www.deadhydra.me/base64.html"
  width="100%"
  height="600"
  frameborder="0"
  style="border-radius: 15px;"
></iframe>

Preview

Usage Examples

Password Hashing Example

Securely hash passwords before storing.

// Using SHA-256 for password hashing
async function hashPassword(password, salt) {
  const combined = salt + password;
  return await sha256Hash(combined);
}

// Generate random salt
function generateSalt() {
  const array = new Uint8Array(16);
  crypto.getRandomValues(array);
  return Array.from(array, b => b.toString(16).padStart(2, '0')).join('');
}

// Usage
const salt = generateSalt();
console.log('Salt:', salt); 
// Output: "a1b2c3d4e5f6..." (32 random hex chars)

const hashedPassword = await hashPassword("myPassword123", salt);
console.log('Hash:', hashedPassword);
// Output: "7f83b1657ff1fc..." (64 hex chars)

// Store both salt and hashedPassword in your database

Data Encoding for URLs

Safely encode data for URL parameters.

// Encode data for URL
function encodeForUrl(data) {
  const json = JSON.stringify(data);
  const base64 = base64Encode(json);
  return encodeURIComponent(base64);
}

// Decode from URL
function decodeFromUrl(encoded) {
  const base64 = decodeURIComponent(encoded);
  const json = base64Decode(base64);
  return JSON.parse(json);
}

// Usage
const data = { name: "John", id: 123 };
const encoded = encodeForUrl(data);
console.log(encoded);
// Output: "eyJuYW1lIjoiSm9obiIsImlkIjoxMjN9"

const url = `https://example.com/api?data=${encoded}`;
console.log(url);
// Output: "https://example.com/api?data=eyJuYW1lIjoiSm9obiIsImlkIjoxMjN9"

const decoded = decodeFromUrl(encoded);
console.log(decoded);
// Output: { name: "John", id: 123 }

File Checksum Verification

Verify file integrity using SHA-256.

async function getFileChecksum(file) {
  const buffer = await file.arrayBuffer();
  const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
  const hashArray = Array.from(new Uint8Array(hashBuffer));
  return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}

// Usage with file input
document.getElementById('fileInput').addEventListener('change', async (e) => {
  const file = e.target.files[0];
  console.log('File:', file.name);
  // Output: "document.pdf"
  
  const checksum = await getFileChecksum(file);
  console.log('SHA-256:', checksum);
  // Output: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
});
← Back to Home

Developer API & Embed Documentation

Integrate The Hydra's encoding and hashing tools into your own website or application. Copy-paste ready JavaScript code for Base64, MD5, SHA-256, Hex, Binary conversions and more. Embed our tools directly using iframe widgets. All code is free to use and processes data client-side for privacy.