コード例 #1
0
ファイル: __init__.py プロジェクト: rtfm-ctf/rtfmapi
def crypto_adfgvx_decipher_api(key:type_key_square(36), keyword: 'The keyword, any word or phrase will do', msg: 'Message to be [de]ciphered'):
        """The ADFGVX Cipher has a key consisting of a 6x6 key square and a word e.g. 'GERMAN'.
The algorithm is described here: http://www.practicalcryptography.com/ciphers/classical-era/adfgvx/
The key square consists of the letters A-Z and the numbers 0-9 (36 characters total)"""
        adfgvx = ADFGVX(key=key, keyword=keyword)
        return adfgvx.decipher(msg)
コード例 #2
0
ファイル: __init__.py プロジェクト: rtfm-ctf/rtfmapi
def crypto_vigenere_encipher_api(key:type_alphabetical_key, msg: 'Message to be [de]ciphered'):
        """The Vigenere Cipher has a key consisting of a word e.g. 'FORTIFICATION'.
This cipher encrypts a letter according to the Vigenere tableau, the algorithm can be 
seen e.g. http://practicalcryptography.com/ciphers/vigenere-gronsfeld-and-autokey-cipher/"""
        vigenere = ADFGVX(key=key)
        return vigenere.encipher(msg)