From e6de84e918ff81000ae9320816e6ab75dfcbdfc2 Mon Sep 17 00:00:00 2001 From: Mohamed Messaoud Louamri Date: Thu, 11 Jul 2024 23:22:11 +0100 Subject: [PATCH 1/3] Fix VN extractor --- cryptomite/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptomite/utils.py b/cryptomite/utils.py index 1b2740e..0ff38e1 100644 --- a/cryptomite/utils.py +++ b/cryptomite/utils.py @@ -284,4 +284,4 @@ def closest_na_set(k: int) -> int: def von_neumann(bits: BitsT) -> BitsT: """ Extract using Von-Neumann extractor. """ - return [x for x, y in zip(bits[::2], bits[1::2]) if x == y] + return [x for x, y in zip(bits[::2], bits[1::2]) if x != y] From 9836fc7223e9c5254bea45c45c20dfffc927a784 Mon Sep 17 00:00:00 2001 From: Mohamed Messaoud Louamri Date: Thu, 11 Jul 2024 23:29:06 +0100 Subject: [PATCH 2/3] Fix VN tests --- test/test_vn.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_vn.py b/test/test_vn.py index 5b14b8d..cb562a8 100644 --- a/test/test_vn.py +++ b/test/test_vn.py @@ -3,11 +3,11 @@ vn_testcases = [ ([], []), - ([0, 1, 0, 1], []), - ([0, 0, 0, 0], [0, 0]), - ([0, 0, 1, 1], [0, 1]), + ([0, 1, 0, 1], [0, 0]), + ([0, 0, 0, 0], []), + ([0, 0, 1, 1], []), ([1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0], - [0, 1, 1, 0, 1]) + [1, 1, 1, 0, 1]) ] From 450764b805461e0d8edda57953cac65ab375ad4f Mon Sep 17 00:00:00 2001 From: Mohamed Messaoud Louamri Date: Thu, 11 Jul 2024 23:32:17 +0100 Subject: [PATCH 3/3] Add VN odd length --- test/test_vn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_vn.py b/test/test_vn.py index cb562a8..e48d8dd 100644 --- a/test/test_vn.py +++ b/test/test_vn.py @@ -6,6 +6,7 @@ ([0, 1, 0, 1], [0, 0]), ([0, 0, 0, 0], []), ([0, 0, 1, 1], []), + ([0, 0, 0, 1, 1, 0, 1, 1, 1], [0, 1]), ([1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1]) ]