added double whitespace behaviour notion
This commit is contained in:
@@ -91,7 +91,7 @@ def ipfencrypt(msg:str, key:str):
|
||||
prefix = ''
|
||||
for i in range(preflen):
|
||||
prefix += secrets.choice(pfgrid[1:])
|
||||
return prefix + ''.join(enc)
|
||||
return prefix + ''.join(enc).replace(' ', '__')
|
||||
|
||||
# Interleaved Playfair decryption method
|
||||
def ipfdecrypt(enc:str, key:str):
|
||||
@@ -99,7 +99,7 @@ def ipfdecrypt(enc:str, key:str):
|
||||
# remove the prefix, then add a space if the cryptogram
|
||||
# had been stripped and ended with a space
|
||||
preflen = (len(key) % 10) + 1
|
||||
enc = enc[preflen:].rstrip()
|
||||
enc = enc[preflen:].rstrip().replace('__', ' ')
|
||||
if len(enc) & 1 == 1:
|
||||
enc += ' '
|
||||
# split into digraphs
|
||||
|
||||
Reference in New Issue
Block a user