Float#
- class usencrypt.cipher.Float(value=None, *args, **kwargs)#
Ciphertext real number, stored in 32.32 fixed-point format.
- Parameters
value (
float
) – The real number to be encrypted. Defaults toNone
.hexstr (
str
) – The hexadecimal representation of the encrypted float object. Defaults toNone
.
See also
- Examples
To create an encrypted real number object from a non-encrypted real number, we can do the following:
>>> import usencrypt as ue >>> ue_x = ue.cipher.Float(value=0.75) >>> ue_x (0x7f078085fee0) Float: 0x96c525b7cab46206f7966ae4d42bc78d10a7b6405422ee643973a472575a87ab
Similarly, we can encrypt a non-encrypted real number directly using the
usencrypt.encrypt()
function:>>> import usencrypt as ue >>> ue_x = ue.encrypt(0.75, dtype=float) >>> ue_x (0x7f078085fee0) Float: 0x96c525b7cab46206f7966ae4d42bc78d10a7b6405422ee643973a472575a87ab
Finally, we can also create an encrypted real number object directly from a hexadecimal string:
>>> import usencrypt as ue >>> ue_x = ue.cipher.Float(hexstr='0x96c525b7cab46206f7966ae4d42bc78d10a7b6405422ee643973a472575a87ab') >>> ue_x (0x7f078085fee0) Float: 0x96c525b7cab46206f7966ae4d42bc78d10a7b6405422ee643973a472575a87ab
METHODS
Returns the conjugate of the encrypted real number \(E(x)\). |
|
Computes the cosine of the encrypted real number \(E(x)\) using \(n\) iterations of the Taylor series approximation method. |
|
Decrypts the encrypted object \(E(x)\), returning the original non-encrypted \(x\). |
|
Encrypts \(x\) dynamically with the same |
|
Computes the exponential of the encrypted real number \(E(x)\) using \(n\) iterations of the Taylor series approximation method. |
|
Computes the natural logarithm of the encrypted real number \(E(x)\) using the Newton-Raphson method. |
|
Computes the sine of the encrypted real number \(E(x)\) using the cosine series approximation method. |
|
Computes the non-negative square-root of the encrypted real number \(E(x)\). |