Logo

index : openmessage

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/openmessage.git/html/README.md blob: 331a85378299c9a636dab2c7fbb41ed9cc74bd99 [raw] [clear marker]

        
0# Open Message
1This programm obfuscates a message, using another text message.
2
3Where `message` is a piece of text you want to obfuscate.
4And where `container` is some text, which will be used for the obfuscation.
5Both will result in a new file, which is the `key`.
6
7Basically, for encoding: `k = m + c`. And for decoding: `m = c - k`.
8
9> [!WARNING]
10> This project is just an experiment on permutations and byte manipulation.
11> It does not provide any secure encryption.
12> It only obfuscates text, which adds no security layer.
13
14## Build
15For the current OS: `cargo build --release`
16
17## Usage
18Encoding:
19`$ om container.txt -e message.txt`
20
21Decoding:
22`$ om container.txt -d key.om`
23
24Decode, don't print the message, and save the message to a file:
25`$ om container.txt -sod key.om`
26
27
28## How it works
29### Encoding
301. Define two strings, where:
31```text
32<message> ::= "the message you want to hide"
33<container> ::= "the text, where the message will be hidden"
34```
35
362. Define the global size of all byte chunks: `<CHUNK_SIZE> ::= 4`
373. Precompute the permutation of `CHUNK_SIZE` using the [Steinhaus-Johnson-Trotter algorithm](https://en.wikipedia.org/wiki/Steinhaus%E2%80%93Johnson%E2%80%93Trotter_algorithm)
384. Split `message` into chunks of `CHUNK_SIZE`
395. Split `container` into padded chunks of `CHUNK_SIZE`
40
41```python
42container = [[0x48, 0x65, 0x6c, 0x6c],
43 [0x6f, 0x00, 0x00, 0x00]]
44
45message = [[0x54, 0x65, 0x73, 0x74]]
46```
47
486. Calculate if the message fits into the container:
49```python
50ceil(permutations.length / message.chunks.length) > container.chunks.length
51```
52
537. Choose a random position inside the container chunks, where to start encoding from.
54
558. Iterate over `container.chunks`,
56 apply the permutation over the current `container.chunk`,
57 and `xor` each permutation with `message.chunk[idx]`,
58 if the permutation is exhausted, go to the next `container.chunk`
59 repeat till `message.chunks` is exhausted.
60
619. Store the xor'ed value, where:
62`<key> ::= <Vector of Bytes>`
63
64```text
65 Message Chunks -> [[A, B, C, D], [E, F, G, H], [I, J, K, L], ...]
66Container Chunks -> [[1, 2, 3, 4], [5, 6, 7, 8], ...]
67
68// one iteration
69Container Chunk -> [ 1 2 3 4 ]
70 P1 1 2 4 3 xor A B C D
71 P2 1 4 2 3 xor E F G H
72 P3 4 1 2 3 xor I J K L
73 .. ... ... ...
74```
75
7610. Generate the header with the position information from Step n, and magic identification value, where:
77```
78<position> ::= <integer>
79<identification> ::= <magic_value>
80
81<magic_value> ::= "OMfmt"
82```
83
8411. Append the `key` with the header
8512. Compress the header + `key` using DEFLATE
8613. Save it as a file
87
88
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit