> ## Content Index
> Fetch the complete content index at: https://snubmonkey.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Decrypt Folders with `age` — Part 2/2: Recovery and Cryptography.
- URL: https://snubmonkey.com/decrypt-folders-age-cryptography/
- Published: 2026-11-18T01:11:00.000Z
- Updated: 2026-11-18T02:23:56.000Z
- Description: Learn how to decrypt and restore folders encrypted with age, and explore the cryptographic mechanisms behind its security, including scrypt and ChaCha20-Poly1305.
- Author: Scarlett Clarke
- Tags: security 🦾🦿, how to 🪄, linux 🐧, macOS, shell 🛠️

In [**Part 1**](https://snubmonkey.com/encrypt-folders-age-linux-macos/): **Encrypting Folders with `age` — Linux and macOS**, we covered installing age, encrypting entire directories with tar, verifying encrypted archives, and safely removing unencrypted copies.

Now, let's explore how to decrypt and restore those archives and understand the cryptographic mechanisms that protect your data.  
  
## How `age` Protects Your Data

In **`age`**, [scrypt](https://en.wikipedia.org/wiki/Scrypt?ref=snubmonkey.com) and [ChaCha20-Poly1305](https://en.wikipedia.org/wiki/ChaCha20-Poly1305?ref=snubmonkey.com) perform two different cryptographic jobs. One protects the passphrase-derived encryption key; the other encrypts and authenticates your actual data.

Understanding the distinction helps explain why **`age`** is designed this way.

## 1\. scrypt — Passphrase-based key derivation

**Key derivation**  
  
A human passphrase is not suitable for direct use as an encryption key. It may be relatively short, predictable, or vulnerable to dictionary attacks.

`age` uses **`scrypt`**, a password-based key derivation function (KDF), to transform your passphrase into cryptographic key material.

How it works:

1. You enter your passphrase.
2. scrypt processes it using a salt and configurable computational and memory costs.
3. It produces derived key material.
4. That material is used to protect the file's encryption key.

**Why scrypt?**

Unlike a simple hash function, `scrypt` deliberately consumes computational resources and memory.

This makes large-scale password guessing more expensive, particularly for attackers using specialized hardware.

The important distinction is that scrypt protects against brute-force attacks on weak passphrases; it does not make a weak passphrase impossible to guess.  

## 2\. ChaCha20-Poly1305 — Encryption and authentication

**Authenticated encryption**

Once the encryption key is established, `age` uses `ChaCha20-Poly1305`, an authenticated encryption with associated data (AEAD) construction.

It combines two cryptographic mechanisms:

- ChaCha20: Encrypts the actual data, making the original plaintext unreadable without the correct key.
- Poly1305: Generates an authentication tag that allows the recipient to detect unauthorized modifications.

**Why does this matter?**

**Encryption** alone provides confidentiality, but **authentication** also helps protect integrity.

For example, if someone modifies the encrypted archive, the authentication check will detect the tampering during decryption.

##   
3\. How they work together

### Your passphrase

Human-readable secret

↓

### scrypt

Memory-hard key derivation

↓

### Encryption key material

↓

### ChaCha20-Poly1305

Encryption + authentication

↓

### Authenticated encrypted data

Confidentiality and integrity protection

## 4\. Does this affect encryption performance?

Yes, but in different ways.

| Component   | Performance impact                        |
| ----------- | ----------------------------------------- |
| scrypt      | Memory and CPU cost during key derivation |
| ChaCha20    | CPU cost while encrypting/decrypting data |
| Poly1305    | Additional authentication processing      |
| tar \+ gzip | CPU and disk I/O overhead                 |

An important distinction: scrypt is not repeatedly processing every file in your directory. Its main cost occurs during passphrase-based key derivation. For large archives, the time-consuming work is generally compression, disk I/O, and bulk encryption.

ChaCha20-Poly1305 is designed to be efficient, including on systems without dedicated AES acceleration.

## 5\. Why age uses this combination

The design provides several useful security properties:

- Resistance to large-scale passphrase guessing through memory-hard key derivation.
- Strong confidentiality through authenticated encryption.
- Detection of encrypted-data modification.
- Efficient streaming encryption for large files and archives.

For additional technical reading:

- [age encryption format specification](https://c2sp.org/age%40v1.1.0?ref=snubmonkey.com)
- [RFC 7914 — scrypt](https://www.rfc-editor.org/rfc/rfc7914?ref=snubmonkey.com)
- [RFC 8439 — ChaCha20 and Poly1305](https://www.rfc-editor.org/rfc/rfc8439?ref=snubmonkey.com)

**scrypt** makes deriving the encryption key from a guessed passphrase expensive; **ChaCha20-Poly1305** protects the actual data and detects tampering. Together, they provide the cryptographic foundation for age's passphrase-based encryption.

We hope this was helpful.  
**Keep learning. Keep exploring. Build a safer open-source community.**