Giter Club home page Giter Club logo

uglyhuffling's Introduction

UglyHuffling

A simple and ugly (read don't judge me) Huffman compression and decompression written in c++ for the final project of my CS301 algorithms and complexity class.

THE ZIP301 FILE FORMAT

A ZIP301 file is in two parts: a plaintext header and a binary body.

The first several lines of the header are formatted thus: [binary string] [whitespace] [character]

In the event that the [character] to encode is itself whitespace, we use the following surrogate encodings:

  • ' ' <==> 'space'
  • '\n' <==> 'newline'
  • '\r' <==> 'return'
  • '\t' <==> 'tab'

After the binary strings, there is a single line of five asterisks: '*****'

Following the asterisks, there is a single line containing the total number of bits, N, in the encoded document. This is necessary because APIs for reading/writing files do not support granularity smaller than one byte. However, a Huffman encoding for an entire document may not necessarily be a multiple of 8. Hence, the final few bits of the final byte in the encoding may not be significant.

This concludes the header. The body (in binary) begins on the next line. It is simply the contents of the original document, encoded using the codes listed in the file header. In the (likely) event that the encoding is not an exact multiple of 8 bits, the final byte will have some insignificant bits at the end of it.

uglyhuffling's People

Contributors

cpitt avatar

Watchers

 avatar  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.