Blowfish class¶
- class crsysapi.Blowfish¶
Blowfish cipher algorithm (Schneier, 1993).
- static decrypt_block(data, key, modestr='ECB', iv=None)¶
Decrypt a block of data. Must be an exact multiple of 8 bytes.
- Parameters:
data (bytes) -- Input data to be decrypted
key (bytes) -- Key of length between 1 and 56 bytes (448 bits)
modestr (str) -- Cipher mode {"[ECB]"|"CBC"|"CFB"|"OFB"|"CTR"}
iv (bytes) -- Initialization Vector (IV) of exactly 8 bytes or
None
for ECB mode
- Returns:
Plaintext in byte array or empty array on error. Output is always the same length as the input.
- Return type:
bytes
- static encrypt_block(data, key, modestr='ECB', iv=None)¶
Encrypt a block of data. Must be an exact multiple of 8 bytes.
- Parameters:
data (bytes) -- Input data to be encrypted
key (bytes) -- Key of length between 1 and 56 bytes (448 bits)
modestr (str) -- Cipher mode {"[ECB]"|"CBC"|"CFB"|"OFB"|"CTR"}
iv (bytes) -- Initialization Vector (IV) of exactly 8 bytes or
None
for ECB mode
- Returns:
Ciphertext in byte array or empty array on error. Output is always the same length as the input.
- Return type:
bytes