transcrypto 1.2.0__py3-none-any.whl → 1.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
transcrypto/aes.py CHANGED
@@ -178,13 +178,21 @@ class AESKey(base.CryptoKey, base.Encryptor, base.Decryptor):
178
178
  return decryptor.update(ciphertext) + decryptor.finalize()
179
179
 
180
180
  def EncryptHex(self, plaintext_hex: str, /) -> str:
181
- """Encrypt a 256 bits hexadecimal block, outputting also a 256 bits hexadecimal block."""
181
+ """Encrypt a 128 bits hexadecimal block, outputting also a 128 bits hexadecimal block."""
182
182
  return base.BytesToHex(self.Encrypt(base.HexToBytes(plaintext_hex)))
183
183
 
184
+ def EncryptHex256(self, plaintext_hex: str, /) -> str:
185
+ """Encrypt a 256 bits hexadecimal block, outputting also a 256 bits hexadecimal block."""
186
+ return self.EncryptHex(plaintext_hex[:32]) + self.EncryptHex(plaintext_hex[32:])
187
+
184
188
  def DecryptHex(self, ciphertext_hex: str, /) -> str:
185
- """Decrypt a 256 bits hexadecimal block, outputting also a 256 bits hexadecimal block."""
189
+ """Decrypt a 128 bits hexadecimal block, outputting also a 128 bits hexadecimal block."""
186
190
  return base.BytesToHex(self.Decrypt(base.HexToBytes(ciphertext_hex)))
187
191
 
192
+ def DecryptHex256(self, ciphertext_hex: str, /) -> str:
193
+ """Decrypt a 256 bits hexadecimal block, outputting also a 256 bits hexadecimal block."""
194
+ return self.DecryptHex(ciphertext_hex[:32]) + self.DecryptHex(ciphertext_hex[32:])
195
+
188
196
  def ECBEncoder(self) -> AESKey.ECBEncoderClass:
189
197
  """Return a AESKey.ECBEncoderClass object using this key."""
190
198
  return AESKey.ECBEncoderClass(self)