b7fb0630f2c466412337d25d2e611eeef7bc381b,ciphers/caesar_cipher.py,,decrypt,#Any#Any#,11

Before Change


    decrypted = ""
    for x in strng:
        indx = (ord(x) - key) % 256
        if indx < 32:
            indx = indx + 95
        decrypted = decrypted + chr(indx)
    return decrypted

After Change


def decrypt(input_string: str, key: int) -> str:
    result = ""
    for x in input_string:
        if not x.isalpha():
            result += x
        elif x.isupper():
            result += chr((ord(x) - key - 65) % 26 + 65)
        elif x.islower():
            result += chr((ord(x) - key - 97) % 26 + 97)
    return result


def brute_force(input_string: str) -> None:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: TheAlgorithms/Python
Commit Name: b7fb0630f2c466412337d25d2e611eeef7bc381b
Time: 2019-10-17
Author: 33547678+yuriimchg@users.noreply.github.com
File Name: ciphers/caesar_cipher.py
Class Name:
Method Name: decrypt


Project Name: Logan1x/Python-Scripts
Commit Name: 2ef5c047b4296a807eea8366f67d7f271f0d47de
Time: 2020-06-28
Author: 59202862+Monsieurvishal@users.noreply.github.com
File Name: bin/password-strength-checker.py
Class Name:
Method Name: pass1


Project Name: TheAlgorithms/Python
Commit Name: b7fb0630f2c466412337d25d2e611eeef7bc381b
Time: 2019-10-17
Author: 33547678+yuriimchg@users.noreply.github.com
File Name: ciphers/caesar_cipher.py
Class Name:
Method Name: encrypt