https://github.com/fleschutz/base256u
C++ sample implementation of base256 encoding using Unicode characters.
https://github.com/fleschutz/base256u
base256 base256u binary data encoding unicode
Last synced: 25 days ago
JSON representation
C++ sample implementation of base256 encoding using Unicode characters.
- Host: GitHub
- URL: https://github.com/fleschutz/base256u
- Owner: fleschutz
- License: cc0-1.0
- Created: 2020-10-10T08:10:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-02T09:59:45.000Z (about 2 months ago)
- Last Synced: 2025-04-02T10:33:54.505Z (about 2 months ago)
- Topics: base256, base256u, binary, data, encoding, unicode
- Language: C++
- Homepage:
- Size: 664 KB
- Stars: 12
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Base256 Encoding in Unicode (base256U)
======================================
This repo contains a C++ sample implementation to represent binary data in base256 encoding by using Unicode characters. Typical use cases are representing safe passwords, digital keys, file checksums, identifiers, hashes, extremely big numbers, or data in character-limited messengers.What is base256U?
-----------------
Each byte is represented by exactly one Unicode character and vice versa each Unicode character represents exactly one byte. Therefore, the byte vs Unicode mapping is dead simple:| Byte | Unicode Character | Description |
|--------|------------------------------------|-----------------------|
| 0-9 | '0'-'9' | 10 digits |
| 10-35 | 'A'-'Z' | 26 uppercase letters |
| 36-61 | 'a'-'z' | 26 lowercase letters |
| 62-255 | 'À', 'Á', 'Â', 'Ã', 'Ä', ... | 194 accent letters |✔️ Advantages
--------------
* **Ultra compact**, e.g. just 16 characters like `5iŗ3īÛźUKĺŰÑÞbŒŜ` can encode 128-bit of data.
* **Easy to recognize** due to the accent letters.
* **Safe to use:** can't be remembered (no need to hide it), so people are forced to copy & paste it.
* **Supports double-clicking** for comfortable copy & paste (all Unicode characters are non-terminal ones).
* **Supports all Unicode versions** due to highest code point 387 (requires Unicode 1.0 or higher).
* **Easy to implement**, see [base256U.cpp](base256U.cpp) for a C++ implementation.🔧 Installation
----------------
Requires **cmake** and a **C++ compiler**. Then execute in a terminal window:
```
> git clone https://github.com/fleschutz/base256U # or download und unzip the ZIP file (click the green button)
> cd base256U
> cmake .
> make
> ./base256U
```🎉 Examples
------------
* For 64 bits: `ŖÔńĪ07ėñ`, `RŧáÃĆĶ2Õ`
* For 128 bits: `ĺËĀ8Ę3ĩŔá0VzœĹŀî`, `ŽTĭŊõł3ÐÑęGųĢÛąĶ`, `5iŗ3īÛźUKĺŰÑÞbŒŜ`, `ņĨqvLŀŠsůØŸÙGCŰƀ`
* For 256 bits: `ħŅŹĬšÝŋţĀĸĻňőċqâĮŹúŪßWPŞÓā8æťÁüċ`, `Ě2ħŤRŧáÃĆĶ2ÕŀSŜöĄPŞÜbŰ06lŔùö9ĬŒģ`
* [zeichensalat](https://karme.de/zeichensalat/): a tool to make/run compressed executables copy/pastes using less than 500 unicode characters. It is intended to be used on the fediverse (or in chats).Comparison of Encoding Standards
--------------------------------| Base | Name | Alphabet | Example | Overhead |
|------|----------------------------------------------------------|-------------------------------|---------|----------|
| 2 | Binary | 0 or 1 | 0101101 | +800% |
| 8 | Octal | 0-7 | 7734124 | |
| 10 | Decimal | 0-9 | 3849834 | |
| 16 | [Hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) | 0-9,a-f (case insensitive) | 7a9ff34 | +100% |
| 32 | [Base32](https://en.wikipedia.org/wiki/Base32) | A-Z,2-7 | S7FFQZB | +60% |
| 36 | [Base36](https://en.wikipedia.org/wiki/Base36) | 0-9,A-Z | 7RT99XQ | |
| 45 | Base45 | 0-9,A-Z,space,$,%,*,+,-,.,/,: | 8X%/9:A | |
| 64 | [Base64](https://en.wikipedia.org/wiki/Base64) | A-Z,a-z,0-9,+,- | zA8r+8q | +33%/37% |
| 85 | [Base85](https://en.wikipedia.org/wiki/Ascii85) | !,",#,...,z | 9jqo | +25% |
| 256 | Base256U | 0-9,A-Z,a-z,accent letters | ĘśŃäŞŰÀ | +~75% |How long does it take to break a random key or password?
--------------------------------------------------------
Trying every possible key or password (called a 'brute force attack') at one billion attempts per second:| Key Size | Key Example | Maximum Time Needed |
|----------|------------------------------------|-------------------------------------------|
| 40-bit | `ŞŰÀ8Œ` | about 9 minutes |
| 56-bit | `ŖÔńĪ7ėñ` | about a year |
| 128-bit | `ĤŗwĹĦñŧīijēaqöĜĖŅ` | about 5,783,128,169,837,158,197,871 years |
| 256-bit | `ÿőMêŽĖiĘśŃäŞŰÀ8ŒŽĎäPfSŖÔńiĪ7ėëŷò` | never, for all practical purposes |📧 Feedback
------------
Send your email feedback to: markus.fleschutz [at] gmail.com🤝 License & Copyright
-----------------------
This open source project is licensed under the CC0 license. All trademarks are the property of their respective owners.