Skip to content

Instantly share code, notes, and snippets.

@bloodeagle40234
Created October 12, 2016 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bloodeagle40234/bb18ef695c65785910bf4a846c93e0e9 to your computer and use it in GitHub Desktop.
Save bloodeagle40234/bb18ef695c65785910bf4a846c93e0e9 to your computer and use it in GitHub Desktop.
from pyeclib.ec_iface import ECDriver
from random import shuffle
def select_without_hole(fragments, hole, k):
available = fragments[:hole] + fragments[hole+1:]
shuffle(available)
return available[:k]
if __name__ == '__main__':
driver = ECDriver(ec_type='jerasure_rs_vand', k=9, m=3)
encoded = driver.encode('aaaaaa' * 1024)
print len(encoded[0])
# for i in range(10):
for x in range(12):
fragments = encoded[:]
available = select_without_hole(fragments, x, 9)
recon = driver.reconstruct(available, [x])
print len(recon[0])
print driver.get_metadata(recon[0], formatted=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment