https://github.com/hizkifw/brittle
Force file integrity
https://github.com/hizkifw/brittle
file-format hash integrity integrity-checker python3 xor
Last synced: 4 months ago
JSON representation
Force file integrity
- Host: GitHub
- URL: https://github.com/hizkifw/brittle
- Owner: hizkifw
- Created: 2017-09-02T10:39:19.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-29T05:25:01.000Z (over 6 years ago)
- Last Synced: 2025-03-16T22:13:29.563Z (7 months ago)
- Topics: file-format, hash, integrity, integrity-checker, python3, xor
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# brittle
[](https://travis-ci.org/HizkiFW/brittle)
A format that makes a file completely unreadable if any part of it gets corrupted.
Usage:
- `python ./brittle.py file.txt out.bin`
- `python ./brittle.py file.bin out.txt --decode`## How it works
### Encoding
1. Get hash of entire file (call it hash A)
2. XOR file using hash A
3. Get hash of XOR'd file (call it hash B)
4. XOR hash A using hash B (call it key)
5. Put key at beginning of file### Decoding
1. Hash file excluding key (we get hash B)
2. XOR key using hash B (we get hash A)
3. XOR file excluding key with hash A
4. File is good if its hash matches hash A