- usencrypt.cipher.Char.compareto(self, other, match_case=False)#
Compares the encrypted character \(E(x)\) to another encrypted character \(E(y)\). It returns the following:
-1, if the
otherencrypted character is lexicographically after
1, if the
otherencrypted character is lexicographically before
0, if both encrypted characters are lexicographically similar.
1) – The other encrypted character for
selfto be compared with.
bool) – Indicates whether to terminate when a pad is encountered. Defaults to
An encrypted integer containing an encrypted
otheris lexicographically after
self, an encrypted
otheris lexicographically before
self, or and encrypted
0if both encrypted characters are lexicographically similar.
- Return type
This function works similarly to Java’s
>>> import usencrypt as ue >>> ue_s = ue.encrypt('abcdef') >>> ue_c1 = ue_s >>> ue_c2 = ue_s >>> ue.decrypt(ue_c1.compareto(ue_c2)) -1 >>> ue.decrypt(ue_c2.compareto(ue_c1)) 1 >>> ue.decrypt(ue_c1.compareto(ue_c1)) 0