Logo

index : openmessage

---

  • summary
  • about
  • tree
  • log
  • branches
https://git.ptrace.dev/public/openmessage.git
ssh://git@git.ptrace.dev/public/openmessage.git
LOC: 20%
TOM: 20%
RS: 40%
MD: 20%

Open Message

This programm obfuscates a message, using another text message.

Where message is a piece of text you want to obfuscate. And where container is some text, which will be used for the obfuscation.
Both will result in a new file, which is the key.

Basically, for encoding: k = m + c. And for decoding: m = c - k.

[!WARNING]
This project is just an experiment on permutations and byte manipulation.
It does not provide any secure encryption.
It only obfuscates text, which adds no security layer.

Build

For the current OS: cargo build --release

Usage

Encoding:
$ om container.txt -e message.txt

Decoding:
$ om container.txt -d key.om

Decode, don't print the message, and save the message to a file:
$ om container.txt -sod key.om

How it works

Encoding

  1. Define two strings, where:
<message> ::= "the message you want to hide"
<container> ::= "the text, where the message will be hidden"
  1. Define the global size of all byte chunks: <CHUNK_SIZE> ::= 4
  2. Precompute the permutation of CHUNK_SIZE using the Steinhaus-Johnson-Trotter algorithm
  3. Split message into chunks of CHUNK_SIZE
  4. Split container into padded chunks of CHUNK_SIZE
container = [[0x48, 0x65, 0x6c, 0x6c],
             [0x6f, 0x00, 0x00, 0x00]]

message = [[0x54, 0x65, 0x73, 0x74]]
  1. Calculate if the message fits into the container:
ceil(permutations.length / message.chunks.length) > container.chunks.length
  1. Choose a random position inside the container chunks, where to start encoding from.

  2. Iterate over container.chunks, apply the permutation over the current container.chunk,
    and xor each permutation with message.chunk[idx],
    if the permutation is exhausted, go to the next container.chunk
    repeat till message.chunks is exhausted.

  3. Store the xor'ed value, where:
    <key> ::= <Vector of Bytes>

  Message Chunks -> [[A, B, C, D], [E, F, G, H], [I, J, K, L], ...]
Container Chunks -> [[1, 2, 3, 4], [5, 6, 7, 8], ...]

// one iteration
Container Chunk -> [ 1 2 3 4 ]
             P1      1 2 4 3   xor   A B C D
             P2      1 4 2 3   xor   E F G H
             P3      4 1 2 3   xor   I J K L
             ..      ...       ...   ...
  1. Generate the header with the position information from Step n, and magic identification value, where:
<position> ::= <integer>
<identification> ::= <magic_value>

<magic_value> ::= "OMfmt"
  1. Append the key with the header
  2. Compress the header + key using DEFLATE
  3. Save it as a file
EXPAND COLLAPSE
Name
Size
Modified (UTC)
.gitignore
20 b
2025-04-06
raw
Cargo.lock
11 kB
2025-04-06
raw
Cargo.toml
158 b
2025-04-06
raw
LICENSE
32 kB
2025-04-06
raw
README.md
3 kB
2025-04-06
raw
---
---
main.rs
4 kB
2025-04-06
raw
obfuscator.rs
14 kB
2025-04-06
raw
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit