Mastodon

SHAKE-128 Hash Generator

What is the SHAKE-128 Hash Generator?

The SHAKE-128 Hash Generator is an online tool that allows you to calculate secure cryptographic digests of any custom length. Built on the Keccak sponge construction, SHAKE-128 differs from standard hashing tools because it is an Extendable-Output Function (XOF). Instead of locking you into a fixed digest size, it lets you define the exact output bit length required for your project.

How to Use the SHAKE-128 Hash Generator

Generating custom-length hashes with this online tool takes just a few clicks:

  1. Enter Your Text: Type or paste your string into the input area.
  2. Define Output Length (in bits): Enter your target bit length in the output box (the default is 256 bits, which outputs 64 hexadecimal characters).
  3. Generate Hash: Click the Generate Hash button to instantly calculate your digest.
  4. Copy or Clear: Click Copy Hash to save the output to your clipboard, or Clear to reset all fields.

What is SHAKE-128?

Standardized by the National Institute of Standards and Technology (NIST) under FIPS 202, SHAKE-128 is part of the SHA-3 cryptographic family. Standard hash functions—such as the SHA3-256 Hash Generator or the widely used SHA-256 Hash Generator—always return fixed-size digests regardless of input length.

SHAKE-128, however, operates as an Extendable-Output Function (XOF). It uses the Keccak-p[1600, 24] permutation with a capacity (C) of 256 bits and a rate (R) of 1344 bits. Because the sponge structure can absorb input data and then continuously “squeeze” out output bits for as long as required, SHAKE-128 can produce outputs ranging from 8 bits to millions of bits.

Understanding SHAKE-128 Security

The “128” in SHAKE-128 refers to its target security level against cryptographic attacks, not a fixed output size:

  • Collision Resistance: Offers up to N/2 bits of security (capped at 128 bits if output size N≥256 bits).
  • Preimage Resistance: Provides up to min(N,128) bits of security against finding an input that produces a specific output.
  • Length Extension Immunity: Unlike legacy algorithms generated using the Merkle-Damgård construction, such as the MD5 Hash Generator, SHAKE-128’s sponge construction inherently resists length extension attacks.

SHAKE-128 vs. Standard Hashing Algorithms

Hash AlgorithmFunction TypeFixed Digest SizeSecurity StrengthImmune to Length Extension?
SHAKE-128Extendable-Output Function (XOF)Variable (User-Defined)128 bitsYes
SHAKE-256Extendable-Output Function (XOF)Variable (User-Defined)256 bitsYes
SHA3-256Fixed Hash Function256 bits (64 Hex chars)128 bitsYes
SHA-256Fixed Hash Function256 bits (64 Hex chars)128 bitsNo
MD5Fixed Hash Function128 bits (32 Hex chars)Broken (< 0 bits)No

Real-World Applications of SHAKE-128

SHAKE-128 is widely used in modern cryptographic protocols due to its variable output capacity and strong mathematical security:

  • Key Derivation Functions (KDFs): Derives cryptographic keys of precise required byte lengths (e.g., 128-bit, 192-bit, or 512-bit keys) from master secrets.
  • Pseudorandom Bit Generation: Functions as a deterministic random bit generator (DRBG) by expanding short seeds into long streams of unpredictable bits.
  • Post-Quantum Cryptography (PQC): Serves as a core primitive inside NIST post-quantum standard algorithms, including ML-KEM (Kyber) and ML-DSA (Dilithium).
  • Domain Separation & Customized Checksums: Allows developers to generate unique, fixed-length identity tokens or checksums tailored to specialized storage constraints.

Frequently Asked Questions (FAQs)

1. What does XOF stand for in cryptography?

XOF stands for Extendable-Output Function. Unlike standard hash functions that return fixed-length digests, an XOF allows you to generate output strings of arbitrary length from a single input.

2. What is the default output length for this SHAKE-128 generator?

The default output length is 256 bits, which produces a 64-character hexadecimal string. You can change this number to any positive bit length required for your application.

3. How do I convert bits to hexadecimal characters for the output length?

Each hexadecimal character represents 4 bits. To calculate how many hex characters you will receive, divide your bit length by 4 (for example, 256 bits ÷ 4 = 64 hex characters; 512 bits ÷ 4 = 128 hex characters).

4. What is the difference between SHAKE-128 and SHAKE-256?

SHAKE-128 provides up to 128 bits of security and uses an internal state capacity of 256 bits. SHAKE-256 provides up to 256 bits of security and uses an internal state capacity of 512 bits, offering higher security against quantum and classical collision attacks.

5. Does SHAKE-128 produce the same output as SHA3-256 if I set the bit length to 256?

No. Even if both output 256 bits, SHAKE-128 and SHA3-256 use different internal domain separation padding bytes prior to squeezing the sponge. As a result, the generated hash outputs will be completely different.

6. Is SHAKE-128 reversible?

No. SHAKE-128 is a one-way cryptographic function. You cannot mathematically reverse a SHAKE-128 output digest to retrieve the original plain text input.

7. Is SHAKE-128 suitable for password storage?

While SHAKE-128 is cryptographically secure, fast hash algorithms should not be used directly for raw password hashing without specialized password-stretching algorithms like Argon2, bcrypt, or PBKDF2 with high iteration counts.

8. What happens if I change a single character in the input text?

Due to the avalanche effect inherent in Keccak sponge construction, changing even a single letter, space, or punctuation mark in your input will result in a completely different, uncorrelated output digest.

9. Why is SHAKE-128 safe against length extension attacks?

SHAKE-128 uses the Keccak sponge structure. Internal state bits equal to the capacity parameter (256 bits) are never directly exposed to the output, making it impossible for an attacker to append data to an existing hash and compute a valid updated hash without knowing the secret input.

10. Is my input data secure when using this online tool?

Yes. Calculations run client-side in your web browser using JavaScript. Your input text is processed locally and is never sent across external network servers or stored in remote databases.