16384 encode and decode
Project description
✨ pybase16384 ✨
The python binding for base16384
一种神奇的编码
使用
- 编码/解码文本
>>> import pybase16384 as pybs
>>> pybs.encode_string('hello!!')
'栙擆羼漡'
>>> pybs.decode_string('栙擆羼漡')
'hello!!'
- 编码文件
from io import BytesIO
import pybase16384 as pybs
with open("input.pcm", "rb") as f:
data = f.read()
for i in range(1):
pybs.encode_file(BytesIO(data), open("output2.pcm", 'wb'), True)
- 解码文件
from io import BytesIO
import pybase16384 as pybs
with open("output2.pcm", "rb") as f:
data = f.read()
for i in range(1):
pybs.decode_file(BytesIO(data), open("input2.pcm", 'wb'))
公开函数
def encode(data: bytes) -> bytes: ...
def decode(data: bytes) -> bytes: ...
def decode_file(input: BinaryIO, output: BinaryIO, buf_rate: int = 10) -> None: ...
def encode_file(input: BinaryIO, output: BinaryIO, boolwrite_head: bool = False, buf_rate: int = 10) -> None: ...
def encode_from_string(data: str, write_head: bool = False) -> bytes: ...
def encode_to_string(data: bytes) -> str: ...
def encode_string(data: str) -> str: ...
def decode_from_bytes(data: bytes) -> str: ...
def decode_from_string(data: str) -> bytes: ...
def decode_string(data: str) -> str: ...
-
write_head将显式指明编码出的文本格式(utf16be),以便文本编辑器(如记事本)能够正确渲染,一般在写入文件时使用。
-
buf_rate指定读取文件的策略。当它为n时,则表示一次读取7n或者8n个字节。如果读到的字节长度小于预期,则说明长度不够, 此时,n将减半,恢复文件指针,重新读取。如果当n=1时长度仍然不够,就地encode/decode处理之。
内部函数
- 他们直接来自底层的C库,高性能,但是一般不需要在外部使用
def _encode(data: BufferProtocol) -> bytes: ...
def _decode(data: BufferProtocol) -> bytes: ...
_decode
在解码b'='
开头的数据时不安全:解释器异常
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
pybase16384-0.1.1rc2.tar.gz
(129.1 kB
view hashes)
Built Distributions
Close
Hashes for pybase16384-0.1.1rc2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078ba37c6d21afbc8891c8524ee8f3cafbc6e8a9190e15e0d875f91f34cee529 |
|
MD5 | 7093cad425067ca52b0bb405a667eb85 |
|
BLAKE2b-256 | 52a40199925b0911aeaf1a72eba98a4341609e20e66566f98635a21c58f073b6 |
Close
Hashes for pybase16384-0.1.1rc2-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 929cd96d98d0e6a8e3ea6b07bf1cd6bff9aaeee9a43bec0b618ca007830de60e |
|
MD5 | 850f93f53928e8ee6871b01dc88d2295 |
|
BLAKE2b-256 | 48bd1806c6e29611450c054cc6194031a2396778997b6ec94164c884faaf1dd5 |
Close
Hashes for pybase16384-0.1.1rc2-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6512cb7e509530312933e1cd9f57ba831687811696cff287e0a6acb908f777e |
|
MD5 | ef7fd0aaf9c8818ec798caa85f3fecfb |
|
BLAKE2b-256 | 37270fa167717c0eba79d3a7ce9f5416c87ed13c06ec46ad674f37f45e5024d4 |
Close
Hashes for pybase16384-0.1.1rc2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f5349962184ca26d004557b4772fbc0bc59e8dae3fa32d61c2cd91831a4fc80 |
|
MD5 | 7208f453d0a9eb3dd74f52ee9433c271 |
|
BLAKE2b-256 | b6a289e43db56df20fb510f3ce093cb7be795a190d75480413040642012a277b |
Close
Hashes for pybase16384-0.1.1rc2-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4cb10647591138d95cb2111f69bf77cd3420d14732fbc849b2718a3a40c0786 |
|
MD5 | 0d90a89b964cf8b37119fd15d6e7096b |
|
BLAKE2b-256 | 2367c391d387ce1a6355a32557584e5ea96207361b423c768fe5ecdd471afdff |
Close
Hashes for pybase16384-0.1.1rc2-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd4ddf2934e6a5e4e744a8db995379140753ed969aa560035cadfc9ad73dd7f4 |
|
MD5 | 4ac657d0f61cacc93a2a03752405d8f7 |
|
BLAKE2b-256 | cc919bb626d6b51a0fa0540a4998220d269a6288685d270cd12d9c2bad14c89c |
Close
Hashes for pybase16384-0.1.1rc2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1172b6f7c325265a42f5d4b6ddbf9f0bbe2c07a339580e9b5e3f01c0f0468de1 |
|
MD5 | b62f11d64a67c77daa15c455ed2233cd |
|
BLAKE2b-256 | 92dd074aa9ac419efea26f2a905361c0805d636261d9c475293c16a2d51adca9 |
Close
Hashes for pybase16384-0.1.1rc2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ea861875460e923c38df8156541724f70bc4c3bc46b60e86ac4963a6cbfe825 |
|
MD5 | d752fc33940bdc3cacc5d9d67aeab86b |
|
BLAKE2b-256 | 3347d033f4b93ad8f343e761a9390fdcf011c0033771aa1f342ba6bdfaadc858 |
Close
Hashes for pybase16384-0.1.1rc2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc5d5f0d1096eab4f0d465bbee8e4044d6f76a0c0ac71a8f35f71ca8d6b701d |
|
MD5 | 80bccf4ae961797a21deb72ee36a63af |
|
BLAKE2b-256 | a03db27f527bd4cdc6e953d21add887eeea6eb112ccb9f6ee9cfd2bf7359c4db |
Close
Hashes for pybase16384-0.1.1rc2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23fc1e68f291944ae2f427a817e9636cede8d518dfc9d78a8769ce2b4ceaff51 |
|
MD5 | 70aec4f77ce6b1f8ccfc17c120f34792 |
|
BLAKE2b-256 | 04d68ee5eab56720d1b6a4b1b1f2efcc6b9f23541896724dd24e02706af55a44 |
Close
Hashes for pybase16384-0.1.1rc2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac7d9f6b647521b7fed35a7e7cca4ce828897f89e10d88d75ff03f4fa9711721 |
|
MD5 | 0e4778bbfe9978fdecf943ae0567bd44 |
|
BLAKE2b-256 | cbcf3b71eb70a213fa4377598ad94d2999b252b3ed28e1462d52696ce73f57c8 |
Close
Hashes for pybase16384-0.1.1rc2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 242552738534df5e41833c4ca844fef3dc8ab62c3679668e43c986053c4fc23e |
|
MD5 | b1eb5eaba66f67c184006ff781a73d4f |
|
BLAKE2b-256 | b97406f3a874537eca11eb4e37aa3d75f258d4bdac3ef769c583b939af8d0670 |
Close
Hashes for pybase16384-0.1.1rc2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab2ad799e4d9bb48fa8050f5324c9ce061c6b58188a19c32e600b3a8348dabd3 |
|
MD5 | 94d33a9970e7344a8ca0fe41c4723c0d |
|
BLAKE2b-256 | 0d8cfb5828a640fe4b5f7daac4f29b8c65c7a55502546c61fd863802e75f9b79 |
Close
Hashes for pybase16384-0.1.1rc2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5e7357eb54415f160ac501665a71038d62b3d740b67ae0c612ec93e358f3740 |
|
MD5 | e2ba35183017b29d20b0b70e04d120ed |
|
BLAKE2b-256 | 7fbd45c3439dc717fcbbf36548102cbd670fed34625207253b11b523febc62b8 |
Close
Hashes for pybase16384-0.1.1rc2-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffd67ea53f3ea9abd05da6f0bc8f3e22e40005378fc3a919e74f6d3cace0106b |
|
MD5 | 0389271ff1e7435bd15954e7ca88c9f8 |
|
BLAKE2b-256 | 0ab20892b3a543bc1dc734469664f4e995d61232e601e6837a8a75408447725d |