Char#

class usencrypt.cipher.Char(value=None, mode='static', *args, **kwargs)#

Ciphertext character variable, stored as a 64-bit integer.

Parameters
  • value (str) – The character to be encrypted. Defaults to None.

  • mode (str) – The mode of encryption. Defaults to 'static'.

Note

  • This class will eventually implement UTF-32 encoding.

Examples

To create an encrypted character object from a non-encrypted string with a length of 1, we can do the following:

>>> import usencrypt as ue
>>> ue_x = ue.cipher.Char(value='c')
>>> ue_x
(0x7f24a8b84be0) Char: 0xaf9a829166cdea1177c34107f1d7816a150e801837675d869196530d283e5aae
>>> ue.decrypt(ue_x)
c

METHODS

Char.compareto

Compares the encrypted character \(E(x)\) to another encrypted character \(E(y)\).

Char.decrypt

Decrypts the encrypted object \(E(x)\), returning the original non-encrypted \(x\).

Char.encrypt_other

Encrypts \(x\) dynamically with the same dtype as the encrypted object \(E(x)\).

Char.isalnum

Checks whether the encrypted character \(E(x)\) represents an alpha-numeric ASCII character.

Char.isalpha

Checks whether the encrypted character \(E(x)\) represents an alphabetical ASCII character.

Char.isdigit

Checks whether the encrypted character \(E(x)\) represents a digit ASCII character.

Char.islower

Checks whether the encrypted character \(E(x)\) represents a lowercase ASCII character.

Char.isupper

Checks whether the encrypted character \(E(x)\) represents an uppercase ASCII character.

Char.lower

Returns a new instance of the encrypted character \(E(x)\) converted to a lowercase ASCII character.

Char.upper

Returns a new instance of the encrypted character \(E(x)\) converted to an uppercase ASCII character.