String.count#

usencrypt.cipher.String.count(self, sub: str, start: int = 0, end: int = 0) usencrypt.cipher._int.Int#

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

Parameters
  • sub (str) – The substring to be searched for.

  • start (int) – Index to begin searching at. Defaults to 0.

  • end (int) – Index to end searching at. Defaults to 0.

Returns

An encrypted integer representing the number of times sub is contained within self.

Return type

usencrypt.cipher.Int

Examples
>>> import usencrypt as ue
>>> ue_s = ue.encrypt('USEncryption')
>>> ue_sub = ue.encrypt('USE')
>>> ue_i = ue_s.count(ue_sub)
>>> ue_i
(0x7f2487023310) Int: 0x38b2d2258ab464ce77ddfbb2c07b8ec04a138f01fa8f1524ef7e06c26e997da9
>>> ue.decrypt(ue_i)
1