# FAQ

Frequently asked questions about SRX.

---

## General

### What is SRX?

SRX (Secure Random-access Archive Format) is a modern archive format that combines compression and encryption. It's designed for:
- **Security** - Authenticated encryption with XChaCha20-Poly1305
- **Performance** - Fast compression with Zstd or LZ4
- **Random Access** - Extract portions without processing the entire archive

### Why another archive format?

Traditional formats like ZIP and 7Z were designed decades ago. SRX is built for modern threats and hardware:
- Always encrypted (no optional encryption)
- Modern cryptography (AEAD, Argon2id)
- Chunk-based for parallelism and random access
- No legacy compromises

### Is SRX free?

Yes! SRX is licensed under the **GNU General Public License v3.0**. It's free to use, modify, and distribute.

### What platforms does SRX support?

SRX runs on:
- **Linux** (x86_64, ARM64)
- **macOS** (Intel, Apple Silicon)
- **Windows** (x86_64)
- **FreeBSD** (x86_64)

---

## Usage

### How do I create an archive?

```bash
srx pack input.txt archive.srx -p "your_password"
```

### How do I extract an archive?

```bash
srx unpack archive.srx -p "your_password"
```

### How do I view archive info?

```bash
srx info archive.srx -p "your_password"
```

### Can I use SRX without encryption?

No. SRX always encrypts data. This is by design - it eliminates the risk of accidentally storing sensitive data unencrypted.

### Can I change the password of an archive?

Currently, you need to unpack and repack:

```bash
srx unpack archive.srx -p "old_password"
srx pack extracted_file new_archive.srx -p "new_password"
```

Password change without re-encryption is planned for v1.1.

### Can I pack multiple files?

Currently, SRX packs single files. For multiple files, use tar first:

```bash
tar -cf files.tar file1 file2 file3
srx pack files.tar files.srx -p "password"
```

Multi-file support is planned for v1.1.

---

## Security

### Is SRX secure?

Yes, when used correctly:
- **XChaCha20-Poly1305** - Authenticated encryption
- **Argon2id** - Password hashing resistant to GPU attacks
- **BLAKE3** - Fast, secure integrity verification

### What happens if I forget my password?

**Your data is permanently lost.** There is no backdoor or recovery mechanism. This is by design for security.

### Is my password stored in the archive?

No. The archive stores:
- A random salt (for key derivation)
- Argon2 parameters

The password itself is never stored.

### Can someone crack my password?

With a strong password, it's practically impossible. Argon2id makes each guess expensive:
- 64 MiB memory per guess
- 3 iterations
- 4 parallel threads

A 12-character random password would take centuries to crack.

### Should I use SRX for password storage?

No. SRX is for file encryption. Use a password manager like:
- **pass** - Unix password manager
- **KeePassXC** - Cross-platform
- **Bitwarden** - Cloud-based

### Is SRX quantum-resistant?

Not currently. SRX uses classical cryptography. Post-quantum algorithms are planned for a future version.

---

## Performance

### How fast is SRX?

| Operation | Speed |
|-----------|-------|
| Pack (Zstd-3) | ~400 MB/s |
| Unpack (Zstd-3) | ~1000 MB/s |
| Pack (LZ4) | ~550 MB/s |
| Unpack (LZ4) | ~2200 MB/s |

### Why is my archive larger than the original?

This can happen with:
- **Pre-compressed files** (videos, images, zip files) - Use `-a none`
- **Random data** - Cannot be compressed
- **Small files** - Metadata overhead

### How much memory does SRX use?

- **Default**: ~70-100 MiB
- **Configurable**: Reduce with `SRX_MEMORY_LIMIT` environment variable

### Can I use SRX on low-memory devices?

Yes. Reduce memory usage:

```bash
export SRX_MEMORY_LIMIT=32  # 32 MiB instead of 64
srx pack file.txt file.srx -p "key" -c 65536  # Smaller chunks
```

---

## Compatibility

### Can I open SRX archives on other tools?

No. SRX is a custom format. You need the SRX tool to extract archives.

### Will future versions be backward compatible?

Yes. SRX uses TLV metadata which allows:
- New fields without breaking old readers
- Old readers to skip unknown fields

### Can I use SRX in my Rust project?

Yes! Add to `Cargo.toml`:

```toml
[dependencies]
srx = { git = "https://github.com/Jamshed-develop/srx.git" }
```

### Can I use SRX from other languages?

Not directly, but you can:
- Call the SRX CLI from your language
- Write bindings using FFI (planned for future)

---

## Troubleshooting

### "Invalid password" but I'm sure it's correct

Check for:
- **Typos** - Try typing in a text editor first
- **Copy-paste errors** - Hidden characters
- **Keyboard layout** - Different language settings
- **Caps Lock** - May be enabled

### "Corrupted archive" error

The archive may be:
- **Incomplete** - Transfer interrupted
- **Modified** - Tampered with
- **Wrong version** - Created with newer SRX

Try:
```bash
# Verify file integrity
srx info archive.srx -p "password"
```

### Archive is much larger than expected

You may be compressing pre-compressed data:

```bash
# For videos, images, zip files
srx pack video.mp4 video.srx -p "key" -a none
```

### Out of memory error

Reduce memory usage:

```bash
export SRX_MEMORY_LIMIT=32
srx pack file.txt file.srx -p "key" -c 65536
```

### Slow performance

Try:
- **Use LZ4** for speed: `-a lz4`
- **Lower compression level**: `-l 1`
- **Check disk I/O**: `iostat -x 1`
- **Use release build**: `cargo build --release`

---

## Comparison

### SRX vs ZIP

| Feature | SRX | ZIP |
|---------|-----|-----|
| Encryption | Always | Optional |
| Authenticated | Yes | No (AES) |
| Compression | Zstd/LZ4 | Deflate |
| Random access | Yes | Yes |
| Multi-file | Planned | Yes |

### SRX vs 7Z

| Feature | SRX | 7Z |
|---------|-----|-----|
| Encryption | Always | Optional |
| Authenticated | Yes | Optional |
| Password hashing | Argon2id | SHA-256 |
| Random access | Yes | Limited |
| Open source | Yes | Yes |

### SRX vs age

| Feature | SRX | age |
|---------|-----|-----|
| Compression | Yes | No |
| Random access | Yes | No |
| Password hashing | Argon2id | scrypt |
| Multi-file | Planned | No |
| Focus | Archives | Encryption |

### SRX vs GPG

| Feature | SRX | GPG |
|---------|-----|-----|
| Compression | Built-in | Separate |
| Key management | Password only | Complex |
| Authenticated | Always | Optional |
| Random access | Yes | No |
| Simplicity | High | Low |

---

## Contributing

### How can I contribute?

- **Report bugs** - [GitHub Issues](https://github.com/Jamshed-develop/srx/issues)
- **Request features** - [GitHub Issues](https://github.com/Jamshed-develop/srx/issues)
- **Submit PRs** - [GitHub Pull Requests](https://github.com/Jamshed-develop/srx/pulls)
- **Improve docs** - Wiki and README

### How do I build from source?

```bash
git clone https://github.com/Jamshed-develop/srx.git
cd srx
cargo build --release
```

### How do I run tests?

```bash
cargo test
```

### How do I run benchmarks?

```bash
cargo bench
```

---

## Roadmap

### What's planned for v1.1?

- Multi-file archive support
- Password change without re-encryption
- Progress callbacks for library users
- Pre-built binaries
- Archive verification mode

### What's planned for v1.2?

- Random access read/write
- Streaming mode for large files
- Parallel encryption/decryption
- File comments and timestamps

### What's planned for v2.0?

- GUI application
- Cloud storage integration
- Differential backups
- Hardware acceleration

---

## More Questions?

- Check the [Troubleshooting](Troubleshooting) guide
- Read the [CLI Reference](CLI-Reference)
- Browse the [Library API](Library-API)
- [Open an issue](https://github.com/Jamshed-develop/srx/issues) on GitHub