Skip to content

BaseNEncodings.Net is a base16, base32, base64 encodings(RFC 4648) library for .Net 2.0+, which is according to RFC 4648.

License

Notifications You must be signed in to change notification settings

wujikui/BaseNEncodings.Net

Repository files navigation

BaseNEncodings.Net

BaseNEncodings.Net is a general base16, base32, base64 encodings library for .NET 2.0+, which is according to RFC 4648.

The project java-base-n-encodings was migrated from BaseNEncodings.Net.

The repository had been transfered from wallf.

Features

  • Represents a general Base-N data encoding as an abstract class.
  • Implements standard encodings of RFC 4648.
    • Base 64 Encoding
    • Base 64 Encoding with URL and Filename Safe Alphabet
    • Base 32 Encoding
    • Base 32 Encoding with Extended Hex Alphabet
    • Base 16 Encoding
  • Supports custom alphabet and padding for your Base-N Encoding.
  • Does not contain unsafe code.
  • Includes the simple and informal benchmark subprojects.

Installation

  • Download the assembly and references it manually, or install using NuGet(recommend).

Basic Usage

  1. Adds a reference of the assembly in you project.

     PM> Install-Package WallF.BaseNEncodings
    
  2. Using the WallF.BaseNEncodings namespace.

     using WallF.BaseNEncodings;
    
  3. Gets instance of encodings.

     // standard encoding(RFC 4648)
     BaseEncoding encoding = BaseEncoding.Base64;
     // custom encoding
     char[] alphabet =  {...};
     char padding = '.';
     BaseEncoding encoding = new Base64Encoding(alphabet, padding, "custom encoding");
    
  4. Converts by the methods To/FromBaseString, Encode, Decode.

     BaseEncoding encoding = ...;
     byte[] bin = new byte[1024];
     string baseString = encoding.ToBaseString(bin);
     byte[] data = encoding.FromBaseString(baseString);
     // bin and data contains the same elements
    

Documentation, Simple and Benchmark

  • Documentation comments as the generated XML file(WallF.BaseNEncodings.xml) is included in the package.
  • Repository includes the simple and benchmark subprojects.

About

BaseNEncodings.Net is a base16, base32, base64 encodings(RFC 4648) library for .Net 2.0+, which is according to RFC 4648.

Resources

License

Stars

Watchers

Forks

Packages

No packages published