Simplify and optimize
This commit is contained in:
parent
53a3d1635a
commit
41ba921626
|
@ -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