Miscellaneous functions written in short forms.
Project description
Omnitools
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.53.tar.gz
(4.7 kB
view hashes)
Built Distribution
omnitools-0.0.53-py3-none-any.whl
(18.8 kB
view hashes)
Close
Hashes for omnitools-0.0.53-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b43cf6e4964447a1761cf4a43f42975963a7207009e18266a3acd86de34860d |
|
MD5 | 37cfa02a4cc69fd4887221a18e66cf48 |
|
BLAKE2b-256 | c5f372f374fe144c047856592adb6f19b6def0ba7b207466685517cdb3a38c6d |