playcrypt.primitives module
- playcrypt.primitives.AES(k, m)[source]
Encrypts m with AES in ECB mode.
- Parameters
k – can be 16, 24 or 32 bytes long
m – should be multiple of 128 bits long
- Returns
cipher text
- playcrypt.primitives.AES_I(k, m)[source]
Decrypts m with AES in ECB mode.
- Parameters
k – can be 16, 24 or 32 bytes long
m – should be multiple of 128 bits long
- Returns
plaintext
- playcrypt.primitives.random_string(length)[source]
Function to generate a random string of
length
bytes.- Parameters
length – length of string to generate in bytes
- Returns
Random string of size length.
- playcrypt.primitives.random_string_bits(bits)[source]
Generates a string of
floor(bits/8)
size.- Parameters
bits – How long string should be in bits.
- Returns
Random string of bit length
floor(bits/8)
.
- playcrypt.primitives.rsa_keygen(len)[source]
RSA keygen algorithm returns a dictionary containing values for (n, e, d, p, q).
- Parameters
len – Length of key in bytes that you would like to generate. Must be a multiple of 32 bytes and greater than 128 bytes.
- Returns
A dictionary containing the standard RSA key components (n - modulo, e - encryption exponent, d - decryption exponent, p - first factor of n, q - second factor of n).