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_len(dlen: int) -> int: ...
def decode_len(dlen: int, offset: int) -> int: ...
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处理之。
-
encode_len和decode_len用于计算输出的长度
内部函数
- 他们直接来自底层的C库,高性能,但是一般不需要在外部使用(除非是增加性能)
def _encode(data: BufferProtocol) -> bytes: ...
def _decode(data: BufferProtocol) -> bytes: ...
def _encode_into(data: BufferProtocol, dest: BufferProtocol) -> int: ...
def _decode_into(data: BufferProtocol, dest: BufferProtocol) -> int: ...
_decode在解码b'='开头的数据时不安全:解释器异常_encode_into和_decode_into直接操作缓冲区对象的底层指针,0拷贝,当然也和上面一样的问题,他们是没有检查的
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybase16384-0.2.3.tar.gz.
File metadata
- Download URL: pybase16384-0.2.3.tar.gz
- Upload date:
- Size: 132.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7efca514b84d1261548053a869de6624dc8047242e037bd7b67feb2ccf260674
|
|
| MD5 |
286b8507de179b536d70d36c2dcf6fda
|
|
| BLAKE2b-256 |
b9a2b4b96ecaccefd764d588ac60d2d13763110288da14d97891b36cf81b41ae
|
File details
Details for the file pybase16384-0.2.3-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 193.4 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
623cc384bfcc5b25e0bcfa813b033d2b2e895c2dd62fa193580a1d70fa450d81
|
|
| MD5 |
ad4ce43279baa42cd2ad880d79888d5b
|
|
| BLAKE2b-256 |
6261f231c6a192355a5c13d36725494de0ead3d807100f862519a8532653562c
|
File details
Details for the file pybase16384-0.2.3-cp310-cp310-manylinux2014_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp310-cp310-manylinux2014_x86_64.whl
- Upload date:
- Size: 227.5 kB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1875dc389880a42a6401a3b7cfb410973e9e86331d50f173a3b6a803e6df49
|
|
| MD5 |
d788dc3f07e1e7ac80658b0c5502214b
|
|
| BLAKE2b-256 |
bfdcadc52b634225391e5f9ea01a4457ed0b69d899bd3368bb8d0eb7b320d52c
|
File details
Details for the file pybase16384-0.2.3-cp310-cp310-macosx_10_15_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp310-cp310-macosx_10_15_x86_64.whl
- Upload date:
- Size: 200.7 kB
- Tags: CPython 3.10, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b4c8315ed4577d7eaa431164ff7053c0f867854286d0eb2026d33fcc7510376
|
|
| MD5 |
5f653c791c1f07ee33bf2514579c1758
|
|
| BLAKE2b-256 |
6cb17e272b043ddfcf77d1bd8b901fb88103d4553129530fb632c838037de344
|
File details
Details for the file pybase16384-0.2.3-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 193.5 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66baf5659d02c3f9cb4db88a12f1b454690e429feb5ff751889dbd46cbcd7bcc
|
|
| MD5 |
c3b18bf9f0effcf8e08178e8fd72ee01
|
|
| BLAKE2b-256 |
67b9880420af3f7858151c0520b508257a04b7fd1d32adc17a33627d6aa07039
|
File details
Details for the file pybase16384-0.2.3-cp39-cp39-manylinux2014_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 227.5 kB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1a63e1732aaede8fbc743b442994929cc33846a92d561703864fd8029f5ebac
|
|
| MD5 |
480ed8b938334b3854ee770f0ba77e4a
|
|
| BLAKE2b-256 |
3a1813360d2bcac0ad2abd11aa2f92eb9a30e432c2ebb01437e1693f459f1fce
|
File details
Details for the file pybase16384-0.2.3-cp39-cp39-macosx_10_15_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp39-cp39-macosx_10_15_x86_64.whl
- Upload date:
- Size: 200.6 kB
- Tags: CPython 3.9, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbd61cc032d668c7a9372fa8cc65bc7c84715b82df96446bd493666115a5d95a
|
|
| MD5 |
b6454e944010e0fb24d7b6c046f13347
|
|
| BLAKE2b-256 |
6f8437363ce1ba3da4d2b747ec759e035fb080c0f03746fd8be81487ccff3c44
|
File details
Details for the file pybase16384-0.2.3-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 193.5 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6263e4c4bab262a35765882fe22809a7a1cf892c52d53a03abf66d381bf14a65
|
|
| MD5 |
e4f5dd9d6f03a08367315a67813eb910
|
|
| BLAKE2b-256 |
e5cbd449cc6a7d82ea59b3df54cc37a5153ebd7d8d66f6b1b968b7ec7e849413
|
File details
Details for the file pybase16384-0.2.3-cp38-cp38-manylinux2014_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 227.0 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c134aec4d51c306614d2931d3deb7d6d2a13097a738059e83c6dd933090a2eb6
|
|
| MD5 |
23583c5bb50bea0197ec55c3645ec633
|
|
| BLAKE2b-256 |
8658321bc8cad33bb9edf84867b2cd40a994d3b4165e79eb4e251ff0ac90987c
|
File details
Details for the file pybase16384-0.2.3-cp38-cp38-macosx_10_14_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp38-cp38-macosx_10_14_x86_64.whl
- Upload date:
- Size: 198.5 kB
- Tags: CPython 3.8, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0db3c80a6c21d0ebfee9d0792e2b72c08f36ea7cddef45db2ead37c5e07ed22e
|
|
| MD5 |
d3a049691a8c496515982d4fe2074c62
|
|
| BLAKE2b-256 |
ebef5ab54dae534fed9d86c55dd75d59bc05b4c58020863287e3b6ec85294101
|
File details
Details for the file pybase16384-0.2.3-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 192.7 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eabd1f3017113115009c60f5380b2edd7206c338c3be5ccb57ddeddbdb0b2c73
|
|
| MD5 |
66fe4ecd79b12e825043db1a52c227b5
|
|
| BLAKE2b-256 |
7ca45cd4293788795a77edf8895869589970b2381edc8d1697ede454c791f99b
|
File details
Details for the file pybase16384-0.2.3-cp37-cp37m-manylinux2014_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 225.8 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffdd0f606bd02479f5e1669360b1dafd0ff99520d4b736eb0792f28c9203fd37
|
|
| MD5 |
471cbdb5fc22d7ff66c285beda1a9644
|
|
| BLAKE2b-256 |
da46a87a6b59ed86c4bdfa36d21f4acebf35a085c3e417917ecffd0cc23e9e3e
|
File details
Details for the file pybase16384-0.2.3-cp37-cp37m-macosx_10_14_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 199.2 kB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7013c6dfac5ccb9659a1af442fb901fcfdd3f600b6c89d45fec9c26b88cc3bc9
|
|
| MD5 |
1b5ee371254720c3ba8e5756475f58b7
|
|
| BLAKE2b-256 |
ed69897fe413ae1183533197ff663df7edf3251e6108248a61186979ff4d74d8
|
File details
Details for the file pybase16384-0.2.3-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 192.7 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81f48702a8286b6fd0f4366596ce01936b25e2a915baa1c29add235ef9930fce
|
|
| MD5 |
eeab67785832673a9d7addd53c68f858
|
|
| BLAKE2b-256 |
9d6f2c3171fdac116cc44d26e2387539bf51c2bdb8ee6cc23221220a112258b8
|
File details
Details for the file pybase16384-0.2.3-cp36-cp36m-manylinux2014_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp36-cp36m-manylinux2014_x86_64.whl
- Upload date:
- Size: 226.3 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45a6d1d26d147cfd3ce6ce89caf040f780f473510300046653fc3ff576bd13d2
|
|
| MD5 |
be843fce5b40b50a49d372b6cdf17c9b
|
|
| BLAKE2b-256 |
1676bcf272a1b4523a79429345bcc4da354018e1131db07b44fc852e7445b10a
|
File details
Details for the file pybase16384-0.2.3-cp36-cp36m-macosx_10_14_x86_64.whl.
File metadata
- Download URL: pybase16384-0.2.3-cp36-cp36m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 198.9 kB
- Tags: CPython 3.6m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52bc81ac3db70475ef51d0ae49c8d20637f95a3eb02e12955a682439773a039b
|
|
| MD5 |
c8ee505098a3fd7420184f187c5ce00c
|
|
| BLAKE2b-256 |
da90f1a4fa08f4b2c88ccadf668a2e780530ae2a00bffa83529cc518ef067abe
|