virtualbox/cryptology/__init__.py
def cesar_chiper(characters, msg, shift, reverse=False):
    encrypted_msg = ""
    try:
        shift = int(shift)
    except ValueError:
        raise NotAnIntiger
    "If reversed, make the factor negative."
    factor = 1
    if reverse:
        factor = -1
    "for each character in message."
    for character in msg:
        "Find character, shift it and then add it to the message."
        character_index = characters.index(character)
        encrypted_msg += characters[(character_index+(shift*factor)) % len(characters)]
    "Return the encrypted message"
    return encode(encrypted_msg)
If reversed, make the factor negative.
If reversed, make the factor negative.
If reversed make the factor negative .
def cesar_chiper(characters, msg, shift, reverse=False):
    encrypted_msg = ""
    try:
        shift = int(shift)
    except ValueError:
        raise NotAnIntiger
    factor = 1
    if reverse:
        factor = -1
    for character in msg:
        character_index = characters.index(character)
        encrypted_msg += characters[(character_index+(shift*factor)) % len(characters)]
    return encode(encrypted_msg)
def cesar_chiper ( characters , msg , shift , reverse = False ) : encrypted_msg = "" try : shift = int ( shift ) except ValueError : raise NotAnIntiger factor = 1 if reverse : factor = - 1 "for each character in message." for character in msg : "Find character, shift it and then add it to the message." character_index = characters . index ( character ) encrypted_msg += characters [ ( character_index + ( shift * factor ) ) % len ( characters ) ] "Return the encrypted message" return encode ( encrypted_msg )
If reversed, make the factor negative.
If reversed make the factor negative .
"If reversed, make the factor negative." "for each character in message." "Find character, shift it and then add it to the message." "Return the encrypted message"
characters
msg
shift
reverse