We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8da6cf commit 4ae435aCopy full SHA for 4ae435a
tlslite/mathtls.py
@@ -677,18 +677,17 @@ def paramStrength(param):
677
678
679
def P_hash(macFunc, secret, seed, length):
680
- bytes = bytearray(length)
+ ret = bytearray(length)
681
A = seed
682
index = 0
683
- while 1:
+ while index < length:
684
A = macFunc(secret, A)
685
output = macFunc(secret, A + seed)
686
- for c in output:
687
- if index >= length:
688
- return bytes
689
- bytes[index] = c
690
- index += 1
691
+ how_many = min(length - index, len(output))
+ ret[index:index+how_many] = output[:how_many]
+ index += how_many
+ return ret
+
692
693
def PRF(secret, label, seed, length):
694
#Split the secret into left and right halves
0 commit comments