'digest(text:string) : [string]
Perform the All-or-Nothing package transform on the given
string.  Output is a list of message blocks describing the
transformed text, where each block is a string of bit length equal
to the ciphermodule\'s block_size.'

def digest(self, text):

    key = self._inventkey(self.__key_size)
    K0 = (self.__K0digit * self.__key_size)
    mcipher = self.__newcipher(key)
    hcipher = self.__newcipher(K0)
    block_size = self.__ciphermodule.block_size
    padbytes = (block_size - (len(text) % block_size))
    text = (text + (b('    ') * padbytes))
    s = divmod(len(text), block_size)[0]
    blocks = []
    hashes = []
    for i in range(1, (s + 1)):
        start = ((i - 1) * block_size)
        end = (start + block_size)
        mi = text[start:end]
        assert (len(mi) == block_size)
        cipherblock = mcipher.encrypt(long_to_bytes(i, block_size))
        mticki = (bytes_to_long(mi) ^ bytes_to_long(cipherblock))
        blocks.append(mticki)
        hi = hcipher.encrypt(long_to_bytes((mticki ^ i), block_size))
        hashes.append(bytes_to_long(hi))
    i = (i + 1)
    cipherblock = mcipher.encrypt(long_to_bytes(i, block_size))
    mticki = (padbytes ^ bytes_to_long(cipherblock))
    blocks.append(mticki)
    hi = hcipher.encrypt(long_to_bytes((mticki ^ i), block_size))
    hashes.append(bytes_to_long(hi))
    mtick_stick = (bytes_to_long(key) ^ reduce(operator.xor, hashes))
    blocks.append(mtick_stick)
    return [long_to_bytes(i, self.__ciphermodule.block_size) for i in blocks]
