Skip to main content

Miscellaneous functions written in short forms.

Project description

Omnitools

version license pyversions
donate powered made

Miscellaneous functions written in short forms.

Hierarchy

omnitools
|---- encoding
|   |---- b64
|   |   |---- b64d()
|   |   |---- b64e()
|   |   |---- try_b64d()
|   |   '---- b64d_or_utf8e()
|   |---- file
|   |   '---- charenc()
|   '---- utf8
|       |---- utf8d()
|       |---- utf8e()
|       |---- try_utf8d()
|       '---- try_utf8e()
|---- hashing
|   |---- mac()
|   '---- sha512()
|---- rng
|   |---- randb()
|   '---- randi()
|---- stdout
|   '---- p()
'---- type
    |---- str_or_bytes
    |---- list_or_dict
    |---- key_pair_format
    |---- encryptedsocket_function
    '---- Obj()

Example

python

from omnitools import *

# print and always flush buffer
p("abc")
# abc
# 

# base64 decode
p(b64d(b64e("test")))
# test

# base64 encode
p(b64e("test"))
# dGVzdA==

# try b64d str except return itself
p(try_b64d("test"))
# test

# try b64d str except utf8e str
p(b64d_or_utf8e(randb(64)))
# b"..."

# detect character encoding
p(charenc(b"\xe3\x81\x82"))
# utf-8

# utf8 decode
p(utf8d(utf8e("test")))
# test

# utf8 encode
p(utf8e("test"))
# b"test"

# try utf8d bytes except return itself
p(try_utf8d("test"))

# try utf8e str except return itself
p(try_utf8e(randb(64)))

# hash mac with hmac, sha3_512
p(mac(content="test", key=randb(64)))
# ...

# hash with sha3_512
p(sha512("test"))
# ...

# generate random 64 bytes
p(randb(64))
# b"..."

# generate int from 10**power to 10**(power+1)-1
p(randi(power=2))
# 101 # from 100 to 999

# turn (nested) dict into an object
p(Obj({"a":{"b":{"c":123}}}).a.b.c)
# 123

shell

rem omnitools.exe <function name> [argument] ...
omnitools.exe p abc

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omnitools-0.0.80.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omnitools-0.0.80-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file omnitools-0.0.80.tar.gz.

File metadata

  • Download URL: omnitools-0.0.80.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0

File hashes

Hashes for omnitools-0.0.80.tar.gz
Algorithm Hash digest
SHA256 9d14dcd75d8c9c2b81cd1ac4ac3af7e177af0c22924c8d7a7161ebe21cf3e62b
MD5 208493e20c162d28df8e93cc4271cab8
BLAKE2b-256 ede95785c0998d6457eb6adeb2f146d2695e0b748ab8dc0a0b0b172c93aa5336

See more details on using hashes here.

File details

Details for the file omnitools-0.0.80-py3-none-any.whl.

File metadata

  • Download URL: omnitools-0.0.80-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0

File hashes

Hashes for omnitools-0.0.80-py3-none-any.whl
Algorithm Hash digest
SHA256 595a0212b6b80c4767a8c97245fc112536d8b4b34bfea8814dea9b7ef1bfef40
MD5 fe9c0e88440fe43a97b962bf25e54721
BLAKE2b-256 fd9e3905445ac283bea2c968502fa91862e7a7034794b90b2ab74a7ff86e42fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page