crandas.crypto

crypto.cipher

crandas.crypto.cipher.AES_128(key)

AES-128 cipher

Parameters:

key (bytes column) – AES-128 key as a crandas bytes column of 16 bytes. The number of rows in the column has to match the number of rows in the messages that will be encrypted. If the same key is used for all messages, use key.as_value().

Returns:

Cipher object for AES-128 initialized with the provided key

Return type:

Cipher

crandas.crypto.cipher.AES_192(key)

AES-192 cipher

Parameters:

key (bytes column) – AES-192 key as a crandas bytes column of 24 bytes. The number of rows in the column has to match the number of rows in the messages that will be encrypted. If the same key is used for all messages, use key.as_value().

Returns:

Cipher object for AES-192 initialized with the provided key

Return type:

Cipher

crandas.crypto.cipher.AES_256(key)

AES-256 cipher

Parameters:

key (bytes column) – AES-256 key as a crandas bytes column of 32 bytes. The number of rows in the column has to match the number of rows in the messages that will be encrypted. If the same key is used for all messages, use key.as_value().

Returns:

Cipher object for AES-256 initialized with the provided key

Return type:

Cipher

class crandas.crypto.cipher.Cipher(name, round_keys)

Bases: object

Cipher object, contains the round keys needed for encryption of a message using the encrypt method. Currently only AES-128, AES-192 and AES-256 are supported for 16 byte messages.

encrypt(message)

Encrypt the message given the round keys of the Cipher object

Parameters:

message (bytes column) – Message to be encrypted as a crandas bytes column. Byte length must be equal to the block size of the underlying cipher. For AES this is 16 bytes.

Returns:

Message encrypted with the key belonging to the Cipher

Return type:

bytes column

crypto.hash

crandas.crypto.hash.HMAC_RIPEMD_160(hmac_key)

HMAC RIPEMD-160 keyed hash

Parameters:

hmac_key (bytes column) – HMAC key as a crandas bytes column. A key length up to 64 bytes is supported. The number of rows in the column has to match the number of rows in the messages that will be hashed. If the same key is used for all messages, use hmac_key.as_value().

Returns:

Hash object for HMAC-RIPEMD-160 initialized with the provided key

Return type:

Hash

class crandas.crypto.hash.Hash(name, pre_key=None)

Bases: object

Hash object, denotes a hash function of which a diget of a message can be computed using the digest method. Currently only RIPEMD-160 is supported.

crandas.crypto.hash.RIPEMD_160 = <crandas.crypto.hash.Hash object>

RIPEMD-160 hash