Giter VIP home page Giter VIP logo

nbaser's Introduction

nbaser

nimble

tester linter GitHub deployments GitHub file size in bytes GitHub tag (latest SemVer)

Library allowing for consistent and reversible encode/decode operations between arbitrary unicode character bases. Supports bases from 2 to 256.

Install

$ nimble install nbaser

import in your project and use

import nbaser

const bs58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
echo bs58.decode("1Q2TWHE3GMdB6BZKafqwxXtWAWgFt5Jvm3")
# @[0, 252, 145, 111, 33, 58, 61, 127, 19, 105, 49, 61, 95, 163, 15, 97, 104, 249, 68, 106, 45, 17, 33, 166, 54]

Docs

Available @ https://d-nice.github.io/nbaser/

Includes examples.

Benchmark

Check the benchmarker CI task for current benchmark numbers.

or to test locally

$ nimble benchmark

Notes

This library does not support padding, such as that found in "standard" base32 and base64.

It utilizes the leading zero compression found in base58, thereby supports it and its variants, and does not require padding.

Due to the unicode support, there is quite some performance overhead relatively to just supporting ASCII. It results in up to an order of magnitude slowdown, but should still be fast enough. Check benchmarks.

nbaser's People

Contributors

d-nice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nbaser's Issues

ARC compatibility

Hello! I was testing some Nimble packages with ARC, and found out that your package fails tests with ARC. It turned out that the cause is simple - you're relying in repr which behaves differently for ARC.

I suggest you to consider not using repr at all (since it's really only for humans and isn't supposed to be parsed programmatically), or at least fix it for ARC (and ORC which will probably become the default in 1.4), the simplest possible fix being:

      runedAlphabet.repr[0 .. ^(when defined(gcArc): 1 else: 2)].split("@".runeAtPos(0), 1)[1] &

on line 314 in nbaser.nim

TODO

  • make unicode compatible version
  • read raw binary data for the encoder fuzz entrypoint
    (already does this fine, reading all binary data passed...)
  • test performance increase if doing binary search on base lookup table
  • e189a07 consider predefinining baseAlphabet.toRunes
    outside of the loop (presuming backend or compiler already optimize this)
  • implement code coverage once a non-obtrusive one becomes available for Nim
  • put this in a TODO.md or make a TODO issue...
  • add more coverage for different GCs, or at least refc vs arc
  • consider scheduled or even better, triggered action based on new Nim releases, to test compatibiltiy
  • fix realatively typo in README

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.