MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / __create_sub_keys

Method __create_sub_keys

thirdparty/pydes/pyDes.py:460–482  ·  view source on GitHub ↗

Create the 16 subkeys K[1] to K[16] from the given key

(self)

Source from the content-addressed store, hash-verified

458 # Transform the secret key, so that it is ready for data processing
459 # Create the 16 subkeys, K[1] - K[16]
460 def __create_sub_keys(self):
461 """Create the 16 subkeys K[1] to K[16] from the given key"""
462 key = self.__permutate(des.__pc1, self.__String_to_BitList(self.getKey()))
463 i = 0
464 # Split into Left and Right sections
465 self.L = key[:28]
466 self.R = key[28:]
467 while i < 16:
468 j = 0
469 # Perform circular left shifts
470 while j < des.__left_rotations[i]:
471 self.L.append(self.L[0])
472 del self.L[0]
473
474 self.R.append(self.R[0])
475 del self.R[0]
476
477 j += 1
478
479 # Create one of the 16 subkeys through pc2 permutation
480 self.Kn[i] = self.__permutate(des.__pc2, self.L + self.R)
481
482 i += 1
483
484 # Main part of the encryption algorithm, the number cruncher :)
485 def __des_crypt(self, block, crypt_type):

Callers 1

setKeyMethod · 0.95

Calls 4

__permutateMethod · 0.95
__String_to_BitListMethod · 0.95
getKeyMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected