add readme
This commit is contained in:
2 files changed
+16
-1
No files matched your search
@@ -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
|
||||||
@@ -37,7 +37,9 @@ class index_mapper:
|
|||||||
def verify(i: list[int]):
|
def verify(i: list[int]):
|
||||||
if not i:
|
if not i:
|
||||||
raise ValueError("index_mapper: i must not be empty")
|
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))")
|
raise ValueError("index_mapper: i must be a permutation of range(len(i))")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user