MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / decrypt

Method decrypt

thirdparty/pydes/pyDes.py:807–852  ·  view source on GitHub ↗

decrypt(data, [pad], [padmode]) -> bytes data : bytes to be encrypted pad : Optional argument for decryption padding. Must only be one byte padmode : Optional argument for overriding the padding mode. The data must be a multiple of 8 bytes and will be decrypted with the already specifie

(self, data, pad=None, padmode=None)

Source from the content-addressed store, hash-verified

805 return self.__key3.crypt(data, ENCRYPT)
806
807 def decrypt(self, data, pad=None, padmode=None):
808 """decrypt(data, [pad], [padmode]) -> bytes
809
810 data : bytes to be encrypted
811 pad : Optional argument for decryption padding. Must only be one byte
812 padmode : Optional argument for overriding the padding mode.
813
814 The data must be a multiple of 8 bytes and will be decrypted
815 with the already specified key. In PAD_NORMAL mode, if the
816 optional padding character is supplied, then the un-encrypted
817 data will have the padding characters removed from the end of
818 the bytes. This pad removal only occurs on the last 8 bytes of
819 the data (last data block). In PAD_PKCS5 mode, the special
820 padding end markers will be removed from the data after
821 decrypting, no pad character is required for PAD_PKCS5.
822 """
823 ENCRYPT = des.ENCRYPT
824 DECRYPT = des.DECRYPT
825 data = self._guardAgainstUnicode(data)
826 if pad is not None:
827 pad = self._guardAgainstUnicode(pad)
828 if self.getMode() == CBC:
829 self.__key1.setIV(self.getIV())
830 self.__key2.setIV(self.getIV())
831 self.__key3.setIV(self.getIV())
832 i = 0
833 result = []
834 while i < len(data):
835 iv = data[i:i+8]
836 block = self.__key3.crypt(iv, DECRYPT)
837 block = self.__key2.crypt(block, ENCRYPT)
838 block = self.__key1.crypt(block, DECRYPT)
839 self.__key1.setIV(iv)
840 self.__key2.setIV(iv)
841 self.__key3.setIV(iv)
842 result.append(block)
843 i += 8
844 if _pythonMajorVersion < 3:
845 data = ''.join(result)
846 else:
847 data = bytes.fromhex('').join(result)
848 else:
849 data = self.__key3.crypt(data, DECRYPT)
850 data = self.__key2.crypt(data, ENCRYPT)
851 data = self.__key1.crypt(data, DECRYPT)
852 return self._unpadData(data, pad, padmode)

Callers

nothing calls this directly

Calls 7

_guardAgainstUnicodeMethod · 0.80
getModeMethod · 0.80
getIVMethod · 0.80
cryptMethod · 0.80
_unpadDataMethod · 0.80
setIVMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected