This is Oneliner, an online code implementation for Ruby.

See en.wikipedia.org/wiki/Online_codes

Dependencies:

Oneliner::SuperString

openssl: www.openssl.org/

Oneliner::SuperString

glib: www.gtk.org/download/

Sub packages:

Oneliner::SuperString

A class that has the super power of Online Coding.

Usage:

You create Oneliner::SuperStrings with a regular String as argument, then you use Oneliner::SuperString#encode(size_of_chunk) to get Online Coded data from them.

Then you use Oneliner::SuperString#decode!(chunk) on a new Oneliner::SuperString to recreate the data from the original String. Only a few extra percent (around 10 - my randomness seems to be suboptimal) is needed to recreate the original data this way.

Examples:

s = Oneliner::SuperString.new
s2 = Oneliner::SuperString.new(" " * 1024)
redundant_packages = []
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
redundant_packages << s2.encode(256)
nil while s.decode!(redundant_packages.shift)
assert_equal(s2, s)