Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

iotaledger/tryte-compress-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IOTA Tryte Compress Rust

This repository is now deprecated as it can only be used with the legacy IOTA network.

IOTA Trytes compression/decompression provides a mechanism by which trytes can be more efficiently stored or transmitted.

By considering the data domain and the specific way in which tryte data is used we created an algorithm that works extremely efficiently in the most common use cases. The algorithm is also implemented in such a way as to make it lightweight enough to be used by embedded devices.

The algorithm uses a combination of run-length-encoding and huffman encoding based on a static huffman tree. The static huffman tree was generated by analyzing 10000s of actual transactions.

This code is a port of the JavaScript package https://github.com/iotaledger/tryte-compress-js

Lib

The main library is tryte-compress it exports two functions.

// Accepts trytes converted into their ascii characters, it returns compressed byte data.
fn compress(trytes: &Vec<u8>) -> Vec<u8>

// Accepts byte data returned by compress, it returns the ascii characters for the decompressed trytes.
fn decompress(buffer: &Vec<u8>) -> Vec<u8>

Benchmarks can be performed running cargo bench

CLI

You can run tests by modifying and running the tryte-compress-cli.

License

MIT License - Copyright (c) 2019 IOTA Stiftung

About

Compression/decompression algorithm targetting trytes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages