Make addDataPadding method to avoid clutter. #668
|
@ -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
|
|
||||||
|
|
Reference in New Issue
Block a user