Einzelfunktionenexperimentierverzeichnis in git integriert

This commit is contained in:
2024-03-17 11:13:48 +01:00
parent 99bd1032c2
commit be9e204576
20 changed files with 1025 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
from re import match
def unkennify(text):
# Funktion hier entnommen und angepasst: https://www.namesuppressed.com/software/kenny.py
decoded = ''
codemap = str.maketrans('MmPpFf', '001122')
print(codemap)
n_len = len(text)
i = 0
while i + 3 <= n_len:
if match('[MmPpFf]{3,}', text[i:i + 3]):
# 'mpf' -> '012' -> 5
num = int(text[i:i + 3].translate(codemap), 3)
# 5 -> 'f'
cypher = chr(num + ord('a'))
if text[i].isupper():
cypher = cypher.upper()
decoded = decoded + cypher
i = i + 3
else:
decoded = decoded + text[i]
i = i + 1
if i < n_len:
decoded = decoded + text[i:]
return decoded
print(unkennify("Fmpmppfmmfmp ppmmffmmfmfp ppmmmmpmf"))