Danger
Nothing here should be used for any security purposes.
Types#
Imported with:
import toy_crypto.types
Helpful(?) type declarations and guards.
These are intended to make things easier for me, the author (jpgoldberg). They are not carefully thought out. This module is probably the least stable of any of these unstable modules.
- toy_crypto.types.Byte#
And int representing a single byte.
Currently implemented as a type alias. As a consequence, type checking is not going to identify cases where an int out of the range of a byte is used.
- class toy_crypto.types.PositiveInt#
Positive integer.
alias of
int
- class toy_crypto.types.Prob#
Probability: A float between 0.0 and 1.0
alias of
float
- protocol toy_crypto.types.SupportsBool[source]#
typing.Protocol
.This protocol is runtime checkable.
Classes that implement this protocol must have the following methods / attributes:
- toy_crypto.types.is_byte(val: Any) bool [source]#
True iff val is int s.t. 0 <= val < 256.
- Parameters:
val (
Any
)- Return type:
bool
- toy_crypto.types.is_positive_int(val: Any) TypeGuard[PositiveInt] [source]#
true if val is a float, s.t. 0.0 <= val <= 1.0
- Parameters:
val (
Any
)- Return type:
TypeGuard
[NewType
(PositiveInt
,int
)]