Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- from enigmini import Enigmini
- from secretpy import CryptMachine
- def encdec(cipher, plaintext, key):
- print('=' * 80)
- print(plaintext)
- enc = cipher.encrypt(plaintext, key)
- print(enc)
- print(cipher.decrypt(enc, key))
- key = {
- 'square': 'ON1CSXIGL3HT5ZRA8DP6WE2JFKU0YQ97B4MV',
- 'reflector': 'KP',
- 'rotor_offsets': (0, 0), # Grundstellung
- 'ring_offsets': (0, 0), # Ringstellung
- 'rotor_order': ('KP_II', 'KP_I'),
- 'steckers': []
- }
- cipher = Enigmini()
- #plaintext = "DEZE VOORBEELDTEKST IS VERCIJFERD MET DE ENIGMINI!"
- #encdec(cipher, plaintext, key)
- code_opgave_b = "UCXOMDTVHMAXJCO6PKSJJ5P4Y18EMYUO2KOGDM31QXT31SEV8JH116"
- plain_b = "IK0KEN0GEEN0ANDERE0LANDEN80ZELFS0AL0BEN0IK0ER0GEWEEST3"
- # IK KEN GEEN ANDERE LANDEN, ZELFS AL BEN IK ER GEWEEST.
- code_opgave_c = "0ULW2BHR3SJALF5P2FWCYONLHPFW7YZN84UPQWNKMTYIEYTYN2QE63SJBLFV6SQE9Y27E2"
- code_opgave_d = "7RBNG4ACEK83YHUZLODARRHEZ3WT8URC4EC3XAQR448CW7NZK434K977B36D7ZEZRBU6PK" + \
- "CCXDSUC4E6QXZ7FZRVYOCEJK3N8AOTEUR44O6Q6AJH4UZ4ONAB8RUEGHEAZPULMBO7RBIQ" + \
- "UTKW78JJCWMKWOCSH6O73YONBV644CEDABR44CDYLR7HUUEC2XS6HIU7L03NBRLJ3CCUP"
- code_opgave_e = "808IXT5279C00PL9S1L4IXR6PR2CZF098JC8ECSIDQDW5KYB0ZU964ZICXHF" + \
- "QDGKOQ2CXHP7HI9XE6KGAVEL0QLDIT IS HET BEGIN!L36HNIQXNMP1YFA"
- # 14b
- for s1_1 in range(1, 7, 1):
- for s1_2 in range(s1_1 + 1, 7, 1):
- for s2_1 in range(s1_1 + 1, 7, 1):
- if s2_1 in (s1_1, s1_2):
- continue
- for s2_2 in range(s2_1 + 1, 7, 1):
- if s2_2 in (s1_1, s1_2):
- continue
- for s3_1 in range(s2_1 + 1, 7, 1):
- if s3_1 in (s1_1, s1_2, s2_1, s2_2):
- continue
- for s3_2 in range(s3_1 + 1, 7, 1):
- if s3_2 in (s1_1, s1_2, s2_1, s2_2):
- continue
- steckers = [(s1_1, s1_2), (s2_1, s2_2), (s3_1, s3_2)]
- key['steckers'] = steckers
- plain = cipher.decrypt(code_opgave_b, key)
- print(f"{key['steckers']} -> {plain}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement