Giter VIP home page Giter VIP logo

b's Introduction

b - Base conversion

Base conversion

Version Build Status Coverage Status License

A Dart library for converting between different bases, e.g., decimal ↔ binary, octal ↔ hexadecimal

Usage

See example/main.dart

Hexadecimal ↔ Base58

final BaseConversion hexadecimalToBase58Converter = BaseConversion(
  from: '0123456789abcdef',
  to: base58,
);

final String base58Value = hexadecimalToBase58Converter('415a59758fb933b6049b050a556dd4d916b7b483f6966615');
// base58Value == '6xZA4Qt9vH7rePWeT5WLaVUZNjB6u6rGc'

final String hexadecimal = hexadecimalToBase58Converter.inverse()('GjWGF6jERR9ymrC1bHcGmsJYkLMDoaySr');
// hexadecimal == 'ac93c8d619c76f823f184110759b278f246cc7cc3cadcac3'

Decimal (emoji) ↔ Hexadecimal

final BaseConversion decimalEmojiToHexadecimalConverter = BaseConversion(
  from: '0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣',
  to: base16,
  zeroPadding: true,
);

final String hexadecimal = decimalEmojiToHexadecimalConverter('5️⃣1️⃣9️⃣6️⃣6️⃣');
// hexadecimal == '0CAFE'

final String decimalEmoji = decimalEmojiToHexadecimalConverter.inverse()('DEADC0DE');
// decimalEmoji == '3️⃣7️⃣3️⃣5️⃣9️⃣2️⃣9️⃣0️⃣5️⃣4️⃣'

Exported alphabets

  • base2 - 01
  • base3 - 012
  • base4 - 0123
  • base5 - 01234
  • base6 - 012345
  • base8 - 01234567
  • base10 - 0123456789
  • base12 - 0123456789AB
  • base16 - 0123456789ABCDEF
  • base32 - ABCDEFGHIJKLMNOPQRSTUVWXYZ234567
  • base32hex - 0123456789ABCDEFGHIJKLMNOPQRSTUV
  • base36 - 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • base58 - 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
  • base62 - 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
  • base64 - ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
  • base64url - ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_

Syntax

BaseConversion({required String from, required String to, bool zeroPadding = false})

from - String of numeral symbols representing the digits of from numeral system.

to - String of numeral symbols representing the digits of to numeral system.

See documentation for more

License

MIT

b's People

Contributors

dkin-om avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.