Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CyberDot.Encoding

Binary-to-text encoding implementations in C#.

Package NuGet Description
CyberDot.Encoding.Base65536 CyberDot.Encoding.Base65536 Base65536 - packs 2 bytes per character using "safe" Unicode code points, so the encoded text is equally valid as UTF-8, UTF-16 or UTF-32.
CyberDot.Encoding.Base2048 CyberDot.Encoding.Base2048 Base2048 - packs 11 bits per character, optimised for services with per-character length limits (e.g. Twitter).

Both packages expose the same shape of API: a static Encode/Decode pair for one-shot use, plus ICryptoTransform implementations (To*Transform/From*Transform) that plug into CryptoStream for streaming encode/decode without buffering the whole payload in memory.

Usage

using CyberDot.Encoding.Base65536;

var bytes = System.Text.Encoding.UTF8.GetBytes("hello world");
var encoded = Base65536.Encode(bytes); // Output: 驨ꍬ啯𒁷ꍲᕤ
var decoded = Base65536.Decode(encoded); // Output: hello world
using CyberDot.Encoding.Base2048;

var bytes = System.Text.Encoding.UTF8.GetBytes("hello world");
var encoded = Base2048.Encode(bytes); // Output: ڵϠɲණæஊಢࢷ
var decoded = Base2048.Decode(encoded); // Output: hello world

See each package's own README for streaming usage and further details:

Solution layout

CyberDot.Encoding.sln
src/
  CyberDot.Encoding.Base65536/        library
  CyberDot.Encoding.Base65536.Tests/  tests
  CyberDot.Encoding.Base2048/         library
  CyberDot.Encoding.Base2048.Tests/   tests

Credits

License

The MIT License (MIT)

About

Base65536 encoding implemented in C#

Topics

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages