Giter Site home page Giter Site logo

eshaz / simple-yenc Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 3.0 31.04 MB

Minimalist JavaScript binary string encoder / decoder with 1-2% overhead, compared to 33%-40% overhead for 6-bit encoding methods like Base64.

License: MIT License

JavaScript 100.00%
base64 binary-encoding dynamic-encode dynenc dynencode hacktoberfest yenc

simple-yenc's People

Contributors

eshaz avatar eyaler avatar jeetiss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

simple-yenc's Issues

Encoding Performance

Dynamic Encode performance could be enhanced by counting the number of bytes for each character in the input and then iterating over that list or using a formula to find the offset that has the least escape characters. This should reduce encoding time to O(n).

Encoding issues when embedding stringified data in html

My use case is to have the binary data embedded in a JS script within a single HTML file, and your solution would give an amazing benefit - if I can get it to work... I have been struggling with encoding issues: If I save the html as utf8 i lose the efficiency as bytes 128-255 get prepended with 194 or 195, however this renders ok. But if I save the html as binary bytes to retain the efficiency, I was not able to find the correct way to specify the html-charset and I was not able to get the html to decode correctly. It would be amazing I you can provide an working html example, and any other help would be highly appreciated.

Multiple offsets

  • Encoded size might be decreased by allowing for mulitple offsets in a single encoded string. A table could be added with byte counts and offsets that describe which offsets to use for each chunk. This would be generated during encoding with the optimal configuration.
  • If there are any byte values that are not used in the input, the largest chunk of escaped characters could be shifted into these byte values as long as the unused byte value does not need to be escaped itself.

CRC32 Validation

Add a CRC32 checksum to the header of a dynamic encoded string to help validate successful decoding.

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.