aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_encoding.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_encoding.py')
-rw-r--r--test/test_encoding.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_encoding.py b/test/test_encoding.py
new file mode 100644
index 0000000..0684945
--- /dev/null
+++ b/test/test_encoding.py
@@ -0,0 +1,12 @@
+from pyecsca.ec.mod import Mod
+from pyecsca.codegen.client import encode_data, decode_data, encode_scalar
+
+
+def test_encode_decode():
+ data = {
+ "a": encode_scalar(0xCAFEBABE),
+ "b": {"c": encode_scalar(Mod(1, 3)), "d": bytes([0x2])},
+ }
+ encoded = encode_data(None, data)
+ result = decode_data(encoded)
+ assert data == result