def __init__(self, message=None, encode=False, decode=False, offset=False,
                 crack=None, verbose=None, alphabet=None):
        """
        A class that encodes, decodes and cracks strings using the Caesar shift
        cipher.

        Accepts messages in a string and encodes or decodes by shifting the
        value of the letter by an arbitrary integer to a different letter in
        the alphabet provided.

        http://en.wikipedia.org/wiki/Caesar_cipher

        Do not ever use this for real communication, but definitely use it for
        fun events like the Hacker Olympics.

        Attributes:
            message: The string you wish to encode.
            encode: A boolean indicating desire to encode the string, used as
                command line script flag.
            decoded: A boolean indicating desire to decode the string, used as
                command line script flag.
            cracked: A boolean indicating to desire to crack the string, used
                as command line script flag.
            verbose: A boolean indicating the desire to turn on debug output,
                use as command line script flag.
            offset: Integer by which you want to shift the value of a letter.
            alphabet: A tuple containing the ASCII alphabet in uppercase.

        Examples:
            Encode a string with a random letter offset.
            >>> cipher = CaesarCipher('I want to encode this string.')
            >>> cipher.encoded
            'W kobh hc sbqcrs hvwg ghfwbu.'

            Encode a string with a specific letter offset.
            >>> cipher = CaesarCipher('I want to encode this string.',
            ...     offset=14)
            >>> cipher.encoded
            'W kobh hc sbqcrs hvwg ghfwbu.'


            Decode a string with a specific letter offset.
            >>> cipher = CaesarCipher('W kobh hc sbqcrs hvwg ghfwbu.',
            ...    offset=14)
            >>> cipher.decoded
            'I want to encode this string.'

            Crack a string of ciphertext without knowing the letter offset.
            >>> cipher = CaesarCipher('W kobh hc sbqcrs hvwg ghfwbu.')
            >>> cipher.cracked
            'I want to encode this string.'
        """
        self.message = message
        self.encode = encode
        self.decode = decode
        self.offset = offset
        self.verbose = verbose
        self.crack = crack
        self.alphabet = alphabet

        # Frequency of letters used in English, taken from Wikipedia.
        # http://en.wikipedia.org/wiki/Letter_frequency
        self.frequency = {
            'a': 0.08167,
            'b': 0.01492,
            'c': 0.02782,
            'd': 0.04253,
            'e': 0.130001,
            'f': 0.02228,
            'g': 0.02015,
            'h': 0.06094,
            'i': 0.06966,
            'j': 0.00153,
            'k': 0.00772,
            'l': 0.04025,
            'm': 0.02406,
            'n': 0.06749,
            'o': 0.07507,
            'p': 0.01929,
            'q': 0.00095,
            'r': 0.05987,
            's': 0.06327,
            't': 0.09056,
            'u': 0.02758,
            'v': 0.00978,
            'w': 0.02360,
            'x': 0.00150,
            'y': 0.01974,
            'z': 0.00074}

        # Get ASCII alphabet if one is not provided by the user.
        if alphabet is None:
            self.alphabet = tuple(string.ascii_lowercase)
def __init__ ( self , message = None , encode = False , decode = False , offset = False , crack = None , verbose = None , alphabet = None ) : self . message = message self . encode = encode self . decode = decode self . offset = offset self . verbose = verbose self . crack = crack self . alphabet = alphabet self . frequency = { 'a' : 0.08167 , 'b' : 0.01492 , 'c' : 0.02782 , 'd' : 0.04253 , 'e' : 0.130001 , 'f' : 0.02228 , 'g' : 0.02015 , 'h' : 0.06094 , 'i' : 0.06966 , 'j' : 0.00153 , 'k' : 0.00772 , 'l' : 0.04025 , 'm' : 0.02406 , 'n' : 0.06749 , 'o' : 0.07507 , 'p' : 0.01929 , 'q' : 0.00095 , 'r' : 0.05987 , 's' : 0.06327 , 't' : 0.09056 , 'u' : 0.02758 , 'v' : 0.00978 , 'w' : 0.02360 , 'x' : 0.00150 , 'y' : 0.01974 , 'z' : 0.00074 } if alphabet is None : self . alphabet = tuple ( string . ascii_lowercase )
A class that encodes, decodes and cracks strings using the Caesar shift
        cipher.

        Accepts messages in a string and encodes or decodes by shifting the
        value of the letter by an arbitrary integer to a different letter in
        the alphabet provided.

        http://en.wikipedia.org/wiki/Caesar_cipher

        Do not ever use this for real communication, but definitely use it for
        fun events like the Hacker Olympics.

        Attributes:
            message: The string you wish to encode.
            encode: A boolean indicating desire to encode the string, used as
                command line script flag.
            decoded: A boolean indicating desire to decode the string, used as
                command line script flag.
            cracked: A boolean indicating to desire to crack the string, used
                as command line script flag.
            verbose: A boolean indicating the desire to turn on debug output,
                use as command line script flag.
            offset: Integer by which you want to shift the value of a letter.
            alphabet: A tuple containing the ASCII alphabet in uppercase.

        Examples:
            Encode a string with a random letter offset.
            >>> cipher = CaesarCipher('I want to encode this string.')
            >>> cipher.encoded
            'W kobh hc sbqcrs hvwg ghfwbu.'

            Encode a string with a specific letter offset.
            >>> cipher = CaesarCipher('I want to encode this string.',
            ...     offset=14)
            >>> cipher.encoded
            'W kobh hc sbqcrs hvwg ghfwbu.'


            Decode a string with a specific letter offset.
            >>> cipher = CaesarCipher('W kobh hc sbqcrs hvwg ghfwbu.',
            ...    offset=14)
            >>> cipher.decoded
            'I want to encode this string.'

            Crack a string of ciphertext without knowing the letter offset.
            >>> cipher = CaesarCipher('W kobh hc sbqcrs hvwg ghfwbu.')
            >>> cipher.cracked
            'I want to encode this string.'