> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/cryptography/hashing/50.-cyberchef.md).

# 50. CyberChef

## Overview

CyberChef is a web-based tool for encoding, decoding, hashing, and transforming data. Often called "the Cyber Swiss Army Knife."

**URL:** <https://gchq.github.io/CyberChef/>

## Key Features for Hash Work

### Compute Hashes

* Operations: `MD5`, `SHA1`, `SHA2-256`, `SHA2-512`, `HMAC`, `Keccak`, etc.
* Input any text or hex → get the hash instantly

### Identify Hash

* Operation: **Analyse hash**
* Paste a hash and CyberChef guesses the type

### Compare Hashes

* Use **HMAC** operation with a known key to verify signatures

## Common CTF Recipes

### Base64 → SHA-256

```
From Base64 → SHA2 256
```

### Detect and Decode Encoding Chain

```
Magic (depth=3)
```

The `Magic` operation auto-detects encoding layers.

### HMAC Verification

```
HMAC
Key: <secret>
Hash Function: SHA-256
```

### Hash a Value

```
SHA2 256
```

### Multiple Encoding Layers

```
From Base64 → From Hex → MD5
```

## Sharing Recipes

CyberChef supports URL-encoded recipes. You can share a full recipe as a link:

```
https://gchq.github.io/CyberChef/#recipe=From_Base64...
```

## CLI Alternative: CyberChef-CLI

```bash
npm install -g cyberchef-cli
echo "hello" | cyberchef -r MD5
```

## Useful Operations Quick Reference

| Task                 | Operation Name        |
| -------------------- | --------------------- |
| Hash (MD5/SHA)       | `MD5`, `SHA1`, `SHA2` |
| HMAC                 | `HMAC`                |
| Base64 encode/decode | `To/From Base64`      |
| Hex encode/decode    | `To/From Hex`         |
| URL encode/decode    | `URL Encode/Decode`   |
| Identify hash        | `Analyse hash`        |
| Auto-detect encoding | `Magic`               |
| XOR                  | `XOR`                 |
| ROT13                | `ROT13`               |
| JWT decode           | `JWT Decode`          |

## CTF Tip

Use **Magic** operation when you have an encoded blob of unknown type — it recursively tries to detect and decode encoding layers.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://alham-rizvi.gitbook.io/alhamrizvi/cryptography/hashing/50.-cyberchef.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
