String#

class usencrypt.cipher.String(value='', *args, **kwargs)#

Ciphertext string, stored as a list of encrypted character instances.

Parameters

value (str) – The string to be encrypted. Defaults to ''.

Examples

To create an encrypted string object from a non-encrypted string, we can do the following:

>>> import usencrypt as ue
>>> ue_s = ue.cipher.String('USEncryption')
>>> ue_s
(0x7f2487ac7ac0) String: 0x60dbf5476c2655a91764258752492e0b754bab60ff78851a3df2c9dde26c952a0xb7deba19f8a3260cc1e023ceef3c458e3326ce1ca6ad4169e5ea139c2f67b29e0xdfc0c9e485d779d01683938f808daaa83886704639890c52f2f11cfcefd8acd10xa48b93d7b5ce8cb24ffb5552f45a2199509563e9266c587e980002a07e543abd0xb5be651ecfeeda6807de19522495b1281fd808564e10d8a5d6b4ca28a547de120xd5bb8883015b1260ed4e0ca5b49b2c831522d6cc3d2635c11365d4ecf566e14e0x3429305520779692655438a9c541cfcf12fe501b109d92b50d1911f1142ad77c0x9ced408ce8570637396ef2dfc327f52cbb05a4518415dcd8deb13bd3602427b30x0e956692854b5d8317fc23f3c39f25c77fc02b0f8525e6a43ee89bd7da9d99c80xb087a62de097d8b1edd05bdf7085fa74603a4082238077c8ed161dc11f8f722c0x79017b49da196d52987f81fbde5e0b8b712ec608364c9b0b3f93def3d3f0481e0xb79be77278cee23cfdfe2e76f2ef1242d866b15c1c7e7e345f4f3910d9e9e38d
>>> ue.decrypt(ue_s)
'USEncryption'

METHODS

String.actual_length

Returns the actual length of the encrypted string \(E(x)\) regarless of the amount of padding characters it contains.

String.bubble

Returns a sorted instance of list of encrypted strings based on their lexicographic order using the bubble sort algorithm.

String.capitalize

Returns a new instance of the encrypted string \(E(x)\), where all the encrypted characters are converted to encrypted uppercase ASCII characters.

String.cipher_length

Returns the actual length of the encrypted string \(E(x)\) regarless of the amount of padding characters it contains.

String.clone

Returns a cloned instance of the encrypted string \(E(x)\).

String.compareto

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

String.concat

Concatenates the encrypted string \(E(x)\) with either another encrypted character, another encrypted string, or any non-encrypted string.

String.containedin

Checks whether the encrypted string \(E(x)\) is contained in the given collection.

String.contains

Checks whether the encrypted string \(E(x)\) contains a given substring.

String.count

Returns the number of times a substring is contained within the encrypted string \(E(x)\).

String.decrypt

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

String.encrypt_other

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

String.endswith

Checks whether the encrypted string \(E(x)\) ends with another string.

String.isalnum

Checks whether the encrypted string \(E(x)\) contains only encrypted alpha-numeric ASCII characters.

String.isalpha

Checks whether the encrypted string \(E(x)\) contains only encrypted alphabetical ASCII characters.

String.isdigit

Checks whether the encrypted string \(E(x)\) contains only encrypted digit ASCII characters.

String.islower

Checks whether the encrypted string \(E(x)\) contains only encrypted lowercase ASCII characters.

String.isnumber

Checks whether the encrypted string \(E(x)\) contains only encrypted number ASCII characters.

String.isupper

Checks whether the encrypted string \(E(x)\) contains only encrypted uppercase ASCII characters.

String.lower

Returns an instance of the encrypted string \(E(x)\) where all its encrypted characters are converted to encrypted lowercase ASCII characters.

String.startswith

Checks whether the encrypted string \(E(x)\) starts with another string.

String.swap

Swaps two encrypted strings, \(E(x)\) and \(E(y)\), based on the given encrypted boolean condition.

String.upper

Returns an instance of the encrypted string \(E(x)\) where all its encrypted characters are converted to encrypted uppercase ASCII characters.