'chaff( [(serial-number:int, data:string, MAC:string)] )
: [(int, string, string)]
Add chaff to message blocks.  blocks is a list of 3-tuples of the
form (serial-number, data, MAC).
Chaff is created by choosing a random number of the same
byte-length as data, and another random number of the same
byte-length as MAC.  The message block\'s serial number is
placed on the chaff block and all the packet\'s chaff blocks
are randomly interspersed with the single wheat block.  This
method then returns a list of 3-tuples of the same form.
Chaffed blocks will contain multiple instances of 3-tuples
with the same serial number, but the only way to figure out
which blocks are wheat and which are chaff is to perform the
MAC hash and compare values.'

def chaff(self, blocks):

    chaffedblocks = []
    count = (len(blocks) * self.__factor)
    blocksper = range(self.__blocksper)
    for (i, wheat) in zip(range(len(blocks)), blocks):
        if (i < count):
            (serial, data, mac) = wheat
            datasize = len(data)
            macsize = len(mac)
            addwheat = 1
            for j in blocksper:
                import sys
                chaffdata = self._randnum(datasize)
                chaffmac = self._randnum(macsize)
                chaff = (serial, chaffdata, chaffmac)
                if (addwheat and (bytes_to_long(self._randnum(16)) & 64)):
                    chaffedblocks.append(wheat)
                    addwheat = 0
                chaffedblocks.append(chaff)
            if addwheat:
                chaffedblocks.append(wheat)
        else:
            chaffedblocks.append(wheat)
    return chaffedblocks
