File: encode-decode.py

package info (click to toggle)
python-pyeclib 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,632 kB
  • ctags: 405
  • sloc: python: 2,184; ansic: 991; sh: 59; makefile: 53
file content (20 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from __future__ import print_function
from pyeclib.ec_iface import ECDriver
import sys

input = b'test'

# Init
print("init:", end=" ")
ec = ECDriver(k=3, m=3, hd=3, ec_type=sys.argv[1])
print("OK")

# Encode
print("encode:", end=" ")
fragments = ec.encode(input)
print("OK")

# Decode
print("decode:", end=" ")
assert ec.decode(fragments[0:ec.k]) == input
print("OK")