Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
hakavlad committed Oct 14, 2023
1 parent 2455964 commit c111768
Showing 1 changed file with 30 additions and 34 deletions.
64 changes: 30 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,35 @@

# tird

[![License](https://img.shields.io/badge/License-CC0-blue)](https://github.com/hakavlad/tird/blob/main/LICENSE)
[![CodeQL](https://github.com/hakavlad/tird/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/hakavlad/tird/actions/workflows/github-code-scanning/codeql)
[![Releases](https://img.shields.io/github/v/release/hakavlad/tird)](https://github.com/hakavlad/tird/releases)
[![PyPI](https://img.shields.io/pypi/v/tird?color=blue&label=PyPI)](https://pypi.org/project/tird/)
[![CodeQL](https://github.com/hakavlad/tird/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/hakavlad/tird/actions/workflows/github-code-scanning/codeql)
[![Semgrep](https://github.com/hakavlad/tird/actions/workflows/semgrep.yml/badge.svg)](https://github.com/hakavlad/tird/actions/workflows/semgrep.yml)

`tird` *(an acronym for "this is random data")* is a tool for encrypting file contents and hiding random data among other random data.

![screenshot: menu](https://i.imgur.com/HmwR7vV.png)

## Features

- `tird` is a single Python module with no external dependencies (uses `hashlib` module from the standard library for keyfile hashing, keys derivation and for encryption).
- `tird` has no config file and no command line options (except `-d/--debug`). Looking at the shell history will not provide information on how `tird` was used.
- The result of encryption (mode 2) is [PURB](https://en.wikipedia.org/wiki/PURB_(cryptography))-like objects (call this "cryptoblob").
- Cryptoblobs are indistinguishable from random data.
- `tird` uses [randomized padding](https://en.wikipedia.org/wiki/Padding_(cryptography)#Randomized_padding) with max size up to 20% (by default) of the message size.
- `tird` allows you to hide cryptoblobs among other random data (mode 6), use arrays of any other random data as containers for hiding cryptoblobs. Thus, deniable encryption is implemented.
- Auxiliary modes (8 and 9) allow you to create arrays of random data: create files with random data (mode 8) and overwrite files or devices with random data (mode 9) for subsequent hiding of cryptoblobs.
- `tird` supports an unlimited number of passphrases and keyfiles for encryption.
- Directories and devices can also be used as keys.
- `tird` allows you to add metadata (description) and an authentication tag to the encrypted file contents.
- Any file larger than a certain minimum size is a valid `tird` cryptoblob: the use of any keys when decrypting will give some output with the result `OK`.
- `tird` allows you to add comments (description) and an authentication tag to the encrypted file contents.
- Any file larger than a certain minimum size is a valid `tird` cryptoblob: the use of any keys when decrypting will give some output with the result `completed successfully`.
- `tird` only provides symmetric encryption with stream cipher based on XORing plaintext with keystream blocks.
- SHAKE256 XOF output is used to create keystream blocks (chunks of pseudo-random size are used mixed in a pseudo-random way).
- Presumably, `tird` can provide a key space larger than 256 bits: when constructing a keystream block, three different outputs of SHAKE256 are used, for which different parts of the key input are used.
- `tird` is written in Python and uses only the Python standard library (`hashlib` module and the hash functions: `BLAKE2b` for files hashing, `scrypt` as KDF, `SHAKE256` for building keystrem blocks).
- `tird` uses [randomized padding](https://en.wikipedia.org/wiki/Padding_(cryptography)#Randomized_padding) with max size up to 20% (by default) of the message size.
- When encrypting, you can set custom values for the block size of the keystream, number of rounds, derived keys length, metadata size, padding size, and enable debug messages.
- `tird` is a single Python file with no external dependencies.
- `tird` has no config file and no command line options. Looking at the bash history will not provide information on how `tird` was used.
- SHAKE256 XOF output is used to create keystream blocks.
- When encrypting, you can set custom values: randomized padding max %, catpig memory-hard function space and time, and optionally add fake authentication tag.
- `tird` can also be called software for steganography: a cryptoblob can be written over a flash drive or disk. Then the existence of a cryptoblob cannot be detected without statistical analysis to identify areas of high entropy (even this will only suspect, not prove the existence of a cryptoblob).
- If random data is encrypted with default options (without MAC and metadata specified), then it is impossible to prove that this or that key was used for encryption: the decryption result will always be random data.
- `tird` does not report whether this or that decryption key is correct. If a MAC was added during encryption, then when using the correct key, it can be reported "MAC is valid: True". If the MAC was not added during encryption (this is the default behavior), then the only way to find out to pick up the correct key is to statistically analyze the output files.
- If random data is encrypted with default options (without MAC and comments specified), then it is impossible to prove that this or that key was used for encryption: the decryption result will always be random data.
- `tird` does not force you to use any standard extension for output file names. The name of the output file is always set by the user.
- Keyed `BLAKE2b` is used for creating message authentication code (MAC is not added by default). Adding a MAC will help you check the integrity of the data when decrypting.
- The ability to almost unlimitedly increase the key space and the complexity of encryption/decryption when using custom options. You can set dk_len=2047M, keystrem_block_size=2047M, num_rounds=1000000. The downside of complexity is that the encryption/decryption rate is down.
- Keyed `BLAKE2b` is used for creating message authentication code (MAC is added by default and can be optionally faked). Adding a MAC will help you check the integrity of the data when decrypting.
- `tird` does not provide reliable data on whether the entered dectyption keys are correct. This is based on the fact that adding an authentication tag is optional. If a MAC was added during encryption, then when using the correct key, it can be reported "authentication failed!" and "completed successfully". If the MAC was not added during encryption (this is the default behavior), then the only way to find out to pick up the correct key is to statistically analyze the output files.

## Tradeoffs and limitations

Expand All @@ -45,12 +40,12 @@
- `tird` does not support Reed–Solomon error correction.
- `tird` does not support splitting the output into chunks.
- `tird` does not support low-level device reading and writing when used on MS Windows (devices cannot be used as keyfiles, cannot be overwritten, cannot be encrypted or hidden).
- `tird` does not provide a graphical user interface.
- `tird` does not provide a graphical user interface (may be implemented later).
- `tird` does not provide a password generator.
- `tird` does not wipe sensitive data from the heap.
- `tird` can only encrypt one file per iteration. Encryption of directories and multiple files is not supported.
- `tird` does not fake timestamps (may be implemented in the future, but not yet planned).
- `tird` encryption/decryption speed is relatively low (tens of megabytes per second in default settings).
- `tird` does not fake file timestamps (atime, mtime, ctime).
- `tird` encryption/decryption speed is not very fast: 105-115 MiB/s.

## Warnings

Expand All @@ -59,23 +54,20 @@
- Development is ongoing, there may be backward compatibility issues in the future.
- `tird` probably won't help much when used in a compromised environment.
- Parts of the keys may leak into the swap space.
- A huge key space by itself does not give advantages when using short and predictable keys. It is recommended to use long and unpredictable key sets.
- Use long and unpredictable key sets!

## Cryptoblob structure
```
|----------------------------|
| file contents | metadata |
|----------------------------|-----|
| message | MAC |
|----------------------------------|
| plaintext |
|------------------|----------------------------------|------------------|
| salt_h | padding | ciphertext (plaintext^keystream) | padding | salt_f |
|------------------------------------------------------------------------|
| urandom data | encrypted data | urandom data |
|------------------------------------------------------------------------|
| random-looking data |
|------------------------------------------------------------------------|
0+B 512B
+---------------+----------+
| file contents | comments |
+---------------+----------+
24B 0+B | message/payload | 64B 0+B 24B
+------+---------+--------------------------+-----+---------+------+
| salt | padding | ciphertext | MAC | padding | salt |
+------+---------+--------------------------+-----+---------+------+
| urandom data | encrypted random-looking data | urandom data |
+----------------+--------------------------------+----------------+
```

## Usage
Expand Down Expand Up @@ -106,10 +98,14 @@ $ pip install tird
```
or
```bash
$ git clone -b v0.2.1 https://github.com/hakavlad/tird.git && cd tird
$ git clone -b v0.3.0 https://github.com/hakavlad/tird.git && cd tird
$ sudo make install
```

## Feedback

Test reports are welcome. Feel free to post any questions, feedback or criticisms to the [Issues](https://github.com/hakavlad/tird/issues).

## License

[Creative Commons Zero v1.0 Universal](https://github.com/hakavlad/tird/blob/main/LICENSE) (Public Domain Dedication).

0 comments on commit c111768

Please sign in to comment.