From fe5eeea52f89e3f3a8df914e0f23c056ee05c40b Mon Sep 17 00:00:00 2001 From: lda Date: Sat, 3 Oct 2026 03:19:59 +0700 Subject: [PATCH] add readme --- README.md | 13 +++++++++++++ src/whatcryption/pairs/index_mapper.py | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e69de29..bb8bd6a 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,13 @@ +# encryption method + +based 100% on that one Veritasium video + +several bugs raised + fixed by codex + +## what is the encryption method + +the enigma machine. a "rotor cipher" + +`App` takes several rotors, the reflector, and optionally those keyboard configs... + +each rotor is the pairing mechanism, and the rotating + carry/notch thing mechanism diff --git a/src/whatcryption/pairs/index_mapper.py b/src/whatcryption/pairs/index_mapper.py index 1e422cb..20253fb 100644 --- a/src/whatcryption/pairs/index_mapper.py +++ b/src/whatcryption/pairs/index_mapper.py @@ -37,7 +37,9 @@ class index_mapper: def verify(i: list[int]): if not i: raise ValueError("index_mapper: i must not be empty") - if set(i) != set(range(len(i))): # this also clears uniqueness + if len(i) != len(set(i)): + raise ValueError("index_mapper: i must not contain duplicates") + if set(i) != set(range(len(i))): # this clears range raise ValueError("index_mapper: i must be a permutation of range(len(i))")