Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
KEY_LENGTH = 32
IV_LENGTH = 8
def setup(self):
from Crypto.Cipher import Salsa20
self.cipher = Salsa20.new(key=self.key, nonce=self.iv)
class AES_256_CFB_Cipher(BaseCipher):
KEY_LENGTH = 32
IV_LENGTH = 16
SEGMENT_SIZE = 128
def setup(self):
from Crypto.Cipher import AES
self.cipher = AES.new(self.key, AES.MODE_CFB, iv=self.iv, segment_size=self.SEGMENT_SIZE)
class AES_128_CFB_Cipher(AES_256_CFB_Cipher):
KEY_LENGTH = 16
class AES_192_CFB_Cipher(AES_256_CFB_Cipher):
KEY_LENGTH = 24
class AES_256_CFB8_Cipher(AES_256_CFB_Cipher):
SEGMENT_SIZE = 8
class AES_192_CFB8_Cipher(AES_256_CFB8_Cipher):
KEY_LENGTH = 24
class AES_128_CFB8_Cipher(AES_256_CFB8_Cipher):
KEY_LENGTH = 16
class AES_256_OFB_Cipher(BaseCipher):
KEY_LENGTH = 32
IV_LENGTH = 16
def setup(self):
from Crypto.Cipher import AES
self.cipher = AES.new(self.key, AES.MODE_OFB, iv=self.iv)
class AES_192_OFB_Cipher(AES_256_OFB_Cipher):
from Crypto.Cipher import Salsa20
self.cipher = Salsa20.new(key=self.key, nonce=self.iv)
class AES_256_CFB_Cipher(BaseCipher):
KEY_LENGTH = 32
IV_LENGTH = 16
SEGMENT_SIZE = 128
def setup(self):
from Crypto.Cipher import AES
self.cipher = AES.new(self.key, AES.MODE_CFB, iv=self.iv, segment_size=self.SEGMENT_SIZE)
class AES_128_CFB_Cipher(AES_256_CFB_Cipher):
KEY_LENGTH = 16
class AES_192_CFB_Cipher(AES_256_CFB_Cipher):
KEY_LENGTH = 24
class AES_256_CFB8_Cipher(AES_256_CFB_Cipher):
SEGMENT_SIZE = 8
class AES_192_CFB8_Cipher(AES_256_CFB8_Cipher):
KEY_LENGTH = 24
class AES_128_CFB8_Cipher(AES_256_CFB8_Cipher):
KEY_LENGTH = 16
class AES_256_OFB_Cipher(BaseCipher):
KEY_LENGTH = 32
IV_LENGTH = 16
def setup(self):
from Crypto.Cipher import AES
self.cipher = AES.new(self.key, AES.MODE_OFB, iv=self.iv)
class AES_192_OFB_Cipher(AES_256_OFB_Cipher):
KEY_LENGTH = 24
class AES_128_OFB_Cipher(AES_256_OFB_Cipher):
KEY_LENGTH = 16
class Salsa20_Cipher(BaseCipher):
KEY_LENGTH = 32
IV_LENGTH = 8
def setup(self):
from Crypto.Cipher import Salsa20
self.cipher = Salsa20.new(key=self.key, nonce=self.iv)
class AES_256_CFB_Cipher(BaseCipher):
KEY_LENGTH = 32
IV_LENGTH = 16
SEGMENT_SIZE = 128
def setup(self):
from Crypto.Cipher import AES
self.cipher = AES.new(self.key, AES.MODE_CFB, iv=self.iv, segment_size=self.SEGMENT_SIZE)
class AES_128_CFB_Cipher(AES_256_CFB_Cipher):
KEY_LENGTH = 16
class AES_192_CFB_Cipher(AES_256_CFB_Cipher):
KEY_LENGTH = 24
class AES_256_CFB8_Cipher(AES_256_CFB_Cipher):
SEGMENT_SIZE = 8
class AES_192_CFB8_Cipher(AES_256_CFB8_Cipher):
KEY_LENGTH = 24
class AES_128_CFB8_Cipher(AES_256_CFB8_Cipher):
KEY_LENGTH = 16
class AES_256_OFB_Cipher(BaseCipher):
KEY_LENGTH = 32
IV_LENGTH = 16
def setup(self):
from Crypto.Cipher import AES