Create the 16 subkeys K[1] to K[16] from the given key
(self)
| 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): |
no test coverage detected