cryptoolz.crypto package

Submodules

cryptoolz.crypto.circuits module

class cryptoolz.crypto.circuits.CircuitInsBase[source]

Bases: BaseModel

class Config[source]

Bases: object

validate_all = True
validate_assignment = True
class cryptoolz.crypto.circuits.CircuitLike(*, ins: InType, outs: Optional[OutType] = None)[source]

Bases: GenericModel, Generic[InType, OutType], ABC

class Config[source]

Bases: object

validate_all = True
validate_assignment = True
abstract classmethod compute_outs(ins: InType) OutType[source]
ins: InType
outs: Optional[OutType]
abstract classmethod validate_circuit_ins(ins: InType) InType[source]
class cryptoolz.crypto.circuits.CircuitOutsBase[source]

Bases: BaseModel

class Config[source]

Bases: object

allow_mutation = False
class cryptoolz.crypto.circuits.DecryptAESGCM(*, ins: <pydantic.fields.DeferredType object at 0x7f961bbf7690>, outs: <pydantic.fields.DeferredType object at 0x7f961bbf7790> = None)[source]

Bases: CircuitLike[InsDecryptAESGCM, OutsDecryptAESGCM]

classmethod compute_outs(ins: InsDecryptAESGCM) OutsDecryptAESGCM[source]
ins: InsDecryptAESGCM
outs: Optional[OutsDecryptAESGCM]
classmethod validate_circuit_ins(ins: InsDecryptAESGCM) InsDecryptAESGCM[source]
class cryptoolz.crypto.circuits.DecryptPBDKF2_AESGCM(*, ins: <pydantic.fields.DeferredType object at 0x7f961bc0e210>, outs: <pydantic.fields.DeferredType object at 0x7f961bc0e310> = None)[source]

Bases: CircuitLike[InsDecryptPBDKF2_AESGCM, OutsDecryptAESGCM]

classmethod compute_outs(ins: InsDecryptPBDKF2_AESGCM) OutsDecryptAESGCM[source]
ins: InsDecryptPBDKF2_AESGCM
outs: Optional[OutsDecryptAESGCM]
classmethod validate_circuit_ins(ins: InsDecryptPBDKF2_AESGCM) InsDecryptPBDKF2_AESGCM[source]
class cryptoolz.crypto.circuits.DerivePBDKF2(*, ins: <pydantic.fields.DeferredType object at 0x7f961bc5f5d0>, outs: <pydantic.fields.DeferredType object at 0x7f961bc5f6d0> = None)[source]

Bases: CircuitLike[InsDerivePBDKF2, OutsDerivePBDKF2]

classmethod compute_outs(ins: InsDerivePBDKF2) OutsDerivePBDKF2[source]
ins: InsDerivePBDKF2
outs: Optional[OutsDerivePBDKF2]
classmethod validate_circuit_ins(ins: InsDerivePBDKF2) InsDerivePBDKF2[source]
class cryptoolz.crypto.circuits.EncryptAESGCM(*, ins: <pydantic.fields.DeferredType object at 0x7f961bc69890>, outs: <pydantic.fields.DeferredType object at 0x7f961bc69990> = None)[source]

Bases: CircuitLike[InsEncryptAESGCM, OutsEncryptAESGCM]

classmethod compute_outs(ins: InsEncryptAESGCM) OutsEncryptAESGCM[source]
ins: InsEncryptAESGCM
outs: Optional[OutsEncryptAESGCM]
classmethod validate_circuit_ins(ins: InsEncryptAESGCM) InsEncryptAESGCM[source]
class cryptoolz.crypto.circuits.EncryptPBDKF2_AESGCM(*, ins: <pydantic.fields.DeferredType object at 0x7f961bc02450>, outs: <pydantic.fields.DeferredType object at 0x7f961bc02550> = None)[source]

Bases: CircuitLike[InsEncryptPBDKF2_AESGCM, OutsEncryptAESGCM]

classmethod compute_outs(ins: InsEncryptPBDKF2_AESGCM) OutsEncryptAESGCM[source]
ins: InsEncryptPBDKF2_AESGCM
outs: Optional[OutsEncryptAESGCM]
classmethod validate_circuit_ins(ins: InsEncryptPBDKF2_AESGCM) InsEncryptPBDKF2_AESGCM[source]
class cryptoolz.crypto.circuits.HashBLAKE2B(*, ins: <pydantic.fields.DeferredType object at 0x7f961bc4b1d0>, outs: <pydantic.fields.DeferredType object at 0x7f961bc4b2d0> = None)[source]

Bases: CircuitLike[InsBLAKE2B, OutsBLAKE2B]

classmethod compute_outs(ins: InsBLAKE2B) OutsBLAKE2B[source]
ins: InsBLAKE2B
outs: Optional[OutsBLAKE2B]
classmethod validate_circuit_ins(ins: InsBLAKE2B) InsBLAKE2B[source]
class cryptoolz.crypto.circuits.InsAESGCM(*, aesgcm_key: Optional[SecretBytes] = None, aesgcm_plaintext: Optional[SecretBytes] = None, aesgcm_nonce: bytes = None)[source]

Bases: BaseModel

aesgcm_key: Optional[SecretBytes]
aesgcm_nonce: bytes
aesgcm_plaintext: Optional[SecretBytes]
class cryptoolz.crypto.circuits.InsBLAKE2B(*, blake2b_data: Optional[List[SecretBytes]] = None, blake2b_intermediate: bool = False, blake2b_digest_size: int = 64)[source]

Bases: BaseModel

blake2b_data: Optional[List[SecretBytes]]
blake2b_digest_size: int
blake2b_intermediate: bool
class cryptoolz.crypto.circuits.InsDecryptAESGCM(*, aesgcm_key: Optional[SecretBytes] = None, aesgcm_cyphertext: bytes = b'', aesgcm_nonce_size_bytes: int = 12)[source]

Bases: CircuitInsBase, OutsAESGCM

aesgcm_cyphertext: bytes
aesgcm_key: Optional[SecretBytes]
aesgcm_nonce_size_bytes: int
class cryptoolz.crypto.circuits.InsDecryptPBDKF2_AESGCM(*, pbdkf2_passphrase: Optional[SecretBytes] = None, pbdkf2_hash_fn_name: str = 'sha3_512', pbdkf2_key_size_bytes: int = 32, pbdkf2_salt: bytes = None, pbdkf2_iterations: int = 40000, pbdkf2_salt_size_bytes: int = 32, aesgcm_key: Optional[SecretBytes] = None, aesgcm_cyphertext: bytes = b'', aesgcm_nonce_size_bytes: int = 12)[source]

Bases: CircuitInsBase, OutsAESGCM, InsPBDKF2

aesgcm_cyphertext: bytes
aesgcm_key: Optional[SecretBytes]
aesgcm_nonce_size_bytes: int
class cryptoolz.crypto.circuits.InsDerivePBDKF2(*, pbdkf2_passphrase: Optional[SecretBytes] = None, pbdkf2_hash_fn_name: str = 'sha3_512', pbdkf2_key_size_bytes: int = 32, pbdkf2_salt: bytes = None, pbdkf2_iterations: int = 40000, pbdkf2_salt_size_bytes: int = 32)[source]

Bases: CircuitInsBase, InsPBDKF2

pbdkf2_hash_fn_name: str
pbdkf2_iterations: int
pbdkf2_key_size_bytes: int
pbdkf2_passphrase: Optional[SecretBytes]
pbdkf2_salt: bytes
pbdkf2_salt_size_bytes: int
class cryptoolz.crypto.circuits.InsEncryptAESGCM(*, aesgcm_key: Optional[SecretBytes] = None, aesgcm_plaintext: Optional[SecretBytes] = None, aesgcm_nonce: bytes = None)[source]

Bases: CircuitInsBase, InsAESGCM

aesgcm_key: Optional[SecretBytes]
aesgcm_nonce: bytes
aesgcm_plaintext: Optional[SecretBytes]
class cryptoolz.crypto.circuits.InsEncryptPBDKF2_AESGCM(*, pbdkf2_passphrase: Optional[SecretBytes] = None, pbdkf2_hash_fn_name: str = 'sha3_512', pbdkf2_key_size_bytes: int = 32, pbdkf2_salt: bytes = None, pbdkf2_iterations: int = 40000, pbdkf2_salt_size_bytes: int = 32, aesgcm_key: Optional[SecretBytes] = None, aesgcm_plaintext: Optional[SecretBytes] = None, aesgcm_nonce: bytes = None)[source]

Bases: CircuitInsBase, InsAESGCM, InsPBDKF2

aesgcm_key: Optional[SecretBytes]
aesgcm_nonce: bytes
aesgcm_plaintext: Optional[SecretBytes]
class cryptoolz.crypto.circuits.InsPBDKF2(*, pbdkf2_passphrase: Optional[SecretBytes] = None, pbdkf2_hash_fn_name: str = 'sha3_512', pbdkf2_key_size_bytes: int = 32, pbdkf2_salt: bytes = None, pbdkf2_iterations: int = 40000, pbdkf2_salt_size_bytes: int = 32)[source]

Bases: BaseModel

pbdkf2_hash_fn_name: str
pbdkf2_iterations: int
pbdkf2_key_size_bytes: int
pbdkf2_passphrase: Optional[SecretBytes]
pbdkf2_salt: bytes
pbdkf2_salt_size_bytes: int
class cryptoolz.crypto.circuits.OutsAESGCM(*, aesgcm_key: Optional[SecretBytes] = None, aesgcm_cyphertext: bytes = b'', aesgcm_nonce_size_bytes: int = 12)[source]

Bases: BaseModel

aesgcm_cyphertext: bytes
aesgcm_key: Optional[SecretBytes]
aesgcm_nonce_size_bytes: int
class cryptoolz.crypto.circuits.OutsBLAKE2B(*, blake2b_digests: List[bytes] = [])[source]

Bases: BaseModel

blake2b_digests: List[bytes]
class cryptoolz.crypto.circuits.OutsDecryptAESGCM(*, aesgcm_key: Optional[SecretBytes] = None, aesgcm_plaintext: Optional[SecretBytes] = None, aesgcm_nonce: bytes = None)[source]

Bases: CircuitOutsBase, InsAESGCM

aesgcm_key: Optional[SecretBytes]
aesgcm_nonce: bytes
aesgcm_plaintext: Optional[SecretBytes]
class cryptoolz.crypto.circuits.OutsDerivePBDKF2(*, pbdkf2_derived_key: Optional[SecretBytes] = None, pbdkf2_salt: bytes = b'')[source]

Bases: CircuitOutsBase, OutsPBDKF2

pbdkf2_derived_key: Optional[SecretBytes]
pbdkf2_salt: bytes
class cryptoolz.crypto.circuits.OutsEncryptAESGCM(*, aesgcm_key: Optional[SecretBytes] = None, aesgcm_cyphertext: bytes = b'', aesgcm_nonce_size_bytes: int = 12)[source]

Bases: CircuitOutsBase, OutsAESGCM

aesgcm_cyphertext: bytes
aesgcm_key: Optional[SecretBytes]
aesgcm_nonce_size_bytes: int
class cryptoolz.crypto.circuits.OutsPBDKF2(*, pbdkf2_derived_key: Optional[SecretBytes] = None, pbdkf2_salt: bytes = b'')[source]

Bases: BaseModel

pbdkf2_derived_key: Optional[SecretBytes]
pbdkf2_salt: bytes

cryptoolz.crypto.constants module

class cryptoolz.crypto.constants.Primes[source]

Bases: object

static get_least_near_pow_two(bitnum: int, rank: int)[source]

Supports 8-400 and 512 bits, currently.

static get_mersenne(bitnum: int)[source]

Primes below 20k bits supported.

static get_mersenne_by_rank(rank: int)[source]

cryptoolz.crypto.data module

Module contents

class cryptoolz.crypto.SecretBytes(value: bytes)

Bases: SecretField

display() unicode
get_secret_value() bytes
max_length = None
min_length = None
classmethod validate(value: Any) SecretBytes