Make addDataPadding method to avoid clutter. #668

Merged
ghost merged 2 commits from master into master 2014-07-14 20:12:07 +02:00
Showing only changes of commit 41ba921626 - Show all commits

View File

@ -33,10 +33,5 @@ def isHostInPrivateIPRange(host):
return True return True
return False return False
def addDataPadding(data, desiredMsgLength = 12): def addDataPadding(data, desiredMsgLength = 12, paddingChar = '\x00'):
if len(data) >= desiredMsgLength: return data + paddingChar * (desiredMsgLength - len(data))
return data
padded = data
while len(padded) < desiredMsgLength:
padded += '\x00'
return padded