'Based on `dataLen\', determine and return a burst\'s padding.
ScrambleSuit morphs the last packet in a burst, i.e., packets which
don\'t fill the link\'s MTU.  This is done by drawing a random sample
from our probability distribution which is used to determine and return
the padding for such packets.  This effectively gets rid of Tor\'s
586-byte signature.'

def calcPadding(self, dataLen):

    dataLen = (dataLen % const.MTU)
    sampleLen = self.dist.randomSample()
    if (sampleLen >= dataLen):
        padLen = (sampleLen - dataLen)
    else:
        padLen = ((const.MTU - dataLen) + sampleLen)
    if (padLen < const.HDR_LENGTH):
        padLen += const.MTU
    return padLen
