Skip to content

Commit

Permalink
add README
Browse files Browse the repository at this point in the history
  • Loading branch information
vihu committed Jul 14, 2018
1 parent ff6f4fb commit 1d02cd1
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
erlang-erasure
=====
Simple Erlang binding for Jerasure's Reed-Solomon erasure encoding/decoding


Build
-----

$ make

Test
-----

$ make test

Example
-----
```Erlang
1> X = crypto:strong_rand_bytes(128).
<<87,99,184,11,167,112,254,145,210,21,62,139,16,29,141,
220,227,19,250,70,93,69,40,98,233,156,153,122,122,...>>
2> {ok, Shards} = erasure:encode(10, 6, X).
{ok,[{0,128,
<<0,0,0,0,0,0,0,0,87,99,184,11,167,112,254,145>>},
{1,128,
<<210,21,62,139,16,29,141,220,227,19,250,70,93,69,40,98>>},
{2,128,
<<233,156,153,122,122,189,177,26,138,217,59,144,103,102,
237,179>>},
{3,128,
<<219,247,235,1,121,15,121,41,12,29,20,199,117,149,174,
119>>},
{4,128,
<<165,67,206,226,147,158,78,254,169,105,104,40,231,21,
192,114>>},
{5,128,
<<34,174,109,134,59,17,137,217,106,169,112,174,80,54,137,
88>>},
{6,128,
<<209,218,91,58,127,50,147,10,202,2,250,157,33,97,223,110>>},
{7,128,
<<210,145,74,26,1,103,154,25,237,231,236,115,172,190,23,
143>>},
{8,128,
<<139,25,112,212,37,103,119,153,97,108,95,103,114,111,
117,...>>},
{9,128,<<152,0,0,0,0,0,0,0,0,0,0,0,0,0,...>>},
{10,128,
<<119,193,142,96,224,18,252,66,183,253,60,21,160,...>>},
{11,128,<<194,100,233,198,50,10,224,14,48,214,151,96,...>>},
{12,128,<<125,98,163,166,84,31,239,245,198,17,235,...>>},
{13,128,<<251,8,47,104,224,205,61,26,90,14,...>>},
{14,128,<<193,238,93,19,71,209,52,70,242,...>>},
{15,128,<<"ëð¨CÓrBh("...>>}]}
3> {ok, Decoded} = erasure:decode(10, 6, Shards).
{ok,<<87,99,184,11,167,112,254,145,210,21,62,139,16,29,
141,220,227,19,250,70,93,69,40,98,233,156,153,...>>}
```

0 comments on commit 1d02cd1

Please sign in to comment.