GithubHelp home page GithubHelp logo

roydl / text Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 267 KB

:books: Provides functions for encoding and decoding base 2, 8, 10, 16, 32, 64, 85 and 91 and more

License: MIT License

C# 100.00%
encoding decoding base2 base8 base16 base32 base64 base85 base91 ascii85

text's Introduction

.NET Core Cross-platform License

Build+Test Commits Source

NuGet NuGet Website Mirror

Roydl.Text

The idea was to create a comfortable way of binary-to-text encoding.

You can easily create instances of any type to translate Stream, byte[] or string data. Extension methods are also provided for all types.

Install:

$ dotnet add package Roydl.Text

Binary-To-Text Encoding

Type Encoding
Base-2 Binary character set: 0 and 1
Base-8 Octal character set: 0-7
Base-10 Decimal character set: 0-9
Base-16 Hexadecimal character set: 0-9 and a-f
Base-32 Standard 32-character set: A–Z and 2–7; = for padding
Base-64 Standard 64-character set: A–Z, a–z, 0–9, + and /; = for padding
Base-85 Standard 85-character set: !"#$%&'()*+,-./, 0-9, :;<=>?@, A-Z, []^_` and a-u
Base-91 Standard 91-character set: A–Z, a–z, 0–9, and !#$%&()*+,-.:;<=>?@[]^_`{|}~"

Usage:

// The `value` must be type `string` or `byte[]`, if `BinToTextEncoding` is
// not set, `Base64` is used by default.
string base85text = value.Encode(BinToTextEncoding.Base85);
byte[] original = value.Decode(BinToTextEncoding.Base85); // if `value` to decode is `byte[]`
string original = value.DecodeString(BinToTextEncoding.Base85); // if `value` to decode is `string`

// The `value` of type `string` can also be a file path, which is not
// recommended for large files, in this case you should create a
// `Base85` instance and use `FileStream` to read and write.
string base85text = value.EncodeFile(BinToTextEncoding.Base85);
byte[] original = value.DecodeFile(BinToTextEncoding.Base85);

Would you like to help?

  • Star this Project ⭐ and show me that this project interests you 🤗
  • Open an Issue ☕ to give me your feedback and tell me your ideas and wishes for the future 😎
  • Open a Ticket 📫 if you don't have a GitHub account, you can contact me directly on my website 😉
  • Donate by PayPal 💸 to buy me some cakes 🍰

Please note that I cannot fix bugs that are unknown to me. So do yourself and me the favor and get in touch with me. 🤕

text's People

Contributors

sebgod avatar si13n7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sebgod

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.