ciphers.gronsfeld_cipher

Functions

gronsfeld(→ str)

Encrypt plaintext with the Gronsfeld cipher

Module Contents

ciphers.gronsfeld_cipher.gronsfeld(text: str, key: str) str

Encrypt plaintext with the Gronsfeld cipher

>>> gronsfeld('hello', '412')
'LFNPP'
>>> gronsfeld('hello', '123')
'IGOMQ'
>>> gronsfeld('', '123')
''
>>> gronsfeld('yes, ¥€$ - _!@#%?', '0')
'YES, ¥€$ - _!@#%?'
>>> gronsfeld('yes, ¥€$ - _!@#%?', '01')
'YFS, ¥€$ - _!@#%?'
>>> gronsfeld('yes, ¥€$ - _!@#%?', '012')
'YFU, ¥€$ - _!@#%?'
>>> gronsfeld('yes, ¥€$ - _!@#%?', '')
Traceback (most recent call last):
  ...
ZeroDivisionError: integer modulo by zero