base16384 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.2.0.tar.gz
(129.9 kB
view hashes)
Built Distributions
Close
Hashes for pybase16384-0.2.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 050eba7730d8a6edb8f64aa6d4873bcd460ffd7a8a207f0296dc57226cecb996 |
|
MD5 | fd86b0491ffa90fc49f16dd3a343eae8 |
|
BLAKE2b-256 | 539de0462633e2ef39c83e942c32843b659cbf374257c31a36fc2ded4bb6d4e5 |
Close
Hashes for pybase16384-0.2.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d2bc881567561c2dea7d39e7b62352713018652cdead463003283aa882d6a9d |
|
MD5 | 19cd7a2895da200c1ba63461b24e646c |
|
BLAKE2b-256 | d7a35567cd9fbcc141c18a8cff553a95a08d703df8ca31ac156aa89b2ddb131c |
Close
Hashes for pybase16384-0.2.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbe1c804c8387e72d16eafdabef9374711ee416299d8245d35b8451436e45778 |
|
MD5 | f8d52f3bb4132ffcd3db0368b7963398 |
|
BLAKE2b-256 | 2fdeb2a88909285a7e7e4ecb055b005b12d719aa0ecd5aa83b371919ccbb0007 |
Close
Hashes for pybase16384-0.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4b2fd84be5cec6a381df0f91b54fa7cfd960b5ccedd3824a37732ef8ad8e7da |
|
MD5 | 6057de9f8e47f73354184812ea72e0bf |
|
BLAKE2b-256 | 93040834da4314fabe9c21dbb6a977c1beae777ac97df8e55cf4bbc9d04ef632 |
Close
Hashes for pybase16384-0.2.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f86b80284a9d3dece945b22d6497fccaae5a8bce26e8c6d5f3f7fd31fd3a83a |
|
MD5 | 8b07d7d66cd3c38d6b9dbc334496f41e |
|
BLAKE2b-256 | e61fc380c115053f1a065efc7630791c2ce8a7360dae31ba83d59271160b7e24 |
Close
Hashes for pybase16384-0.2.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6637a3833e69e425f6c98d9c201d27a764e9f9dd5c719dd7636f5beaa3a98c66 |
|
MD5 | dc8f414347f4acaafcc4947d0daf27e4 |
|
BLAKE2b-256 | 96593eb0c1a8e70573aeda72e71d50bb958bdd53dca544f70bdad2827cd272d0 |
Close
Hashes for pybase16384-0.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e65f504ddb4524ae609342ec9f482df4445a061df3766ff85bab59d612e927c0 |
|
MD5 | 0fda1ab9ef360c816667630ece2ae8a7 |
|
BLAKE2b-256 | 554151abb9f4d9a09b520f7a82bf9b9173036e71552c1f6f4acd82d3679fa63a |
Close
Hashes for pybase16384-0.2.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e2deea58dd043bb15445338c99f54584c5f582ebd07e08230cbebc40ae334ad |
|
MD5 | 262524791f6c338d5716475b85d78452 |
|
BLAKE2b-256 | df367c846f3f0e622d54250c865201453e85b6bf4da65a0262865f457e67da81 |
Close
Hashes for pybase16384-0.2.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e88b1b5014cfa437a897ecb7284f5d789a5ce6a4c0be2c8ad3dc3878197d93b |
|
MD5 | 9f47732d2af184055f28435ff4ce3c3f |
|
BLAKE2b-256 | ef03371687e409458593cf97274146dddedf532a0092ff48f867ecc0f887d64b |
Close
Hashes for pybase16384-0.2.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7ef5c8c0033ac330a0642db5b911efad4d5fbd57c33632ef5bf00e470d05b49 |
|
MD5 | 3f5c99241e0e00dc793dd1f98367078e |
|
BLAKE2b-256 | 5ab86ee7fd05045c330c3fb09fde105bf0f8f5274dcbcd595fbb176bd5457110 |
Close
Hashes for pybase16384-0.2.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf40e0058989beb09a5135f5b79ee4842a321e90ef9476f14a76a1fa515c3a56 |
|
MD5 | 269066e9c5a3d5f734862464116fb1b6 |
|
BLAKE2b-256 | fedcdf858275c68d98ae483c82918e18a0697a8ed08d685dc22be5f532bf5112 |
Close
Hashes for pybase16384-0.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ab6d161a712bfbed65f622cb7aa280b273fd475c1b7a1952d88aa88a6961810 |
|
MD5 | 34c0a917996cf5a74a26f12de7323e75 |
|
BLAKE2b-256 | 87e00bedf8ac5871a85ddcf64f821a864f233775b1a05c0772b941015112408a |
Close
Hashes for pybase16384-0.2.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2fb22201ca913416b53abe0f53a1c641dce8a9a2e85f00e7431cb121a50aba4 |
|
MD5 | 403c0f8afa12e827a3cfd5aa8fbcaa86 |
|
BLAKE2b-256 | 6a23e67ac0bb2e305b8d15f37f085d7e741fc08a0672caa8625716cef6bb90f4 |
Close
Hashes for pybase16384-0.2.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef1e950a97d4fa26461ba1cc9c34a5378e2908eab88e2e8afbc60ac8c7bffe35 |
|
MD5 | a2f5c5543044310f596337fb9443fff0 |
|
BLAKE2b-256 | 80e9c467ded3fd9ca5e15c9928544fb7021591b8488039f51e044c216460ea22 |
Close
Hashes for pybase16384-0.2.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5823daef32420163e00e004ed23576b8987ab3e3399af916fa4b5c50107bfcd5 |
|
MD5 | e02444c44c57c25df39e7e47193b062a |
|
BLAKE2b-256 | 7679194ed1796804073dfdafcf7c8ab8c6f7c52df251aba1f48ea9b093706496 |