Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. def base_enc_str(s: str, base=52) -> int:
  2. """base_enc_str
  3. will take a string and attempt to encode the string as base 52 number by
  4. default.
  5.  
  6. :param s:
  7. :type s: str
  8. :param base:
  9. :rtype: int
  10. """
  11. return (
  12. (np.array(list(bytes(s, encoding="utf-8"))) - 64)
  13. * (base ** np.arange(len(s) - 1, -1, -1))
  14. ).sum()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement