PBKDFv2.py (revelation-0.5.3.tar.xz) | : | PBKDFv2.py (revelation-0.5.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 85 | skipping to change at line 85 | |||
# Let l be the number of hLen-octet blocks in the derived key, rounding up | # Let l be the number of hLen-octet blocks in the derived key, rounding up | |||
# and let r be the number of octets in the last block | # and let r be the number of octets in the last block | |||
l = math.ceil(dkLen / float(self.hLen)) | l = math.ceil(dkLen / float(self.hLen)) | |||
#if (dkLen % float(self.hLen)): l = int(l) + 1 # round up if necessary | #if (dkLen % float(self.hLen)): l = int(l) + 1 # round up if necessary | |||
r = dkLen - (l - 1) * self.hLen | r = dkLen - (l - 1) * self.hLen | |||
# Step 3: | # Step 3: | |||
# For each block of the derived key, apply the function F to the | # For each block of the derived key, apply the function F to the | |||
# password P, the salt S, the iteration count c, and the block index | # password P, the salt S, the iteration count c, and the block index | |||
# to compute the block | # to compute the block | |||
T = "" | T = b"" | |||
for blockindex in range(int(l)): | for blockindex in range(int(l)): | |||
T += self.F(P, S, c, blockindex, digesttype) | T += self.F(P, S, c, blockindex, digesttype) | |||
# Step 4 - extract the first dkLen octet to produce a derived key DK | # Step 4 - extract the first dkLen octet to produce a derived key DK | |||
DK = T[:dkLen] | DK = T[:dkLen] | |||
# Step 5 - return the derived key DK | # Step 5 - return the derived key DK | |||
return DK | return DK | |||
################ F | ################ F | |||
def F(self, P, S, c, i, digest): | def F(self, P, S, c, i, digest): | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |