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.1.tar.gz
(128.1 kB
view hashes)
Built Distributions
Close
Hashes for pybase16384-0.1.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5169ca91a1216a2d98b93a354089cf32ea728ed723d1a9e2df0d3b822db8638 |
|
MD5 | fa2d7a0b1032c1ae836b2e1ad1a47b6f |
|
BLAKE2b-256 | 84acfb23e15e3e130dd258ae32ab9057a82c355b9c6ada9013620553f6ff38f2 |
Close
Hashes for pybase16384-0.1.1-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3091e819e310c92b82f09581ee4a5c7c4407870fe3fdbba00df877111b70406 |
|
MD5 | 1d2f571fea076211a2690558900e3f7a |
|
BLAKE2b-256 | adb16ca1dc231cbf7ec42194815527cf654a9282761a0ca52385ae34484e574b |
Close
Hashes for pybase16384-0.1.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efb9d389433f693e3786bb2e67a5363d5cf9a2abd09d6c032343cbd02110f98d |
|
MD5 | 5770c95589e79b7133d97cf217da9c6a |
|
BLAKE2b-256 | 7b452743e3968f468c60b19e04c1cf626ac7287447a43f0722195c2e0fda28e4 |
Close
Hashes for pybase16384-0.1.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97e65b5b3edaed2160d75dbae6f7679c34446080ba21029e778b2579ff62ce8c |
|
MD5 | de26baae49625d9725865b12f0f40708 |
|
BLAKE2b-256 | 8ab28b1ab1a3125607a748eaf94dbfbe06bb29f303846e41e67c60348ce28ffe |
Close
Hashes for pybase16384-0.1.1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ae37a1edd4112d91a47494bd1f031c764afdfe4bcca5f9092091ece508f18a1 |
|
MD5 | f5647eb84aef086bd74e15d70d5a428b |
|
BLAKE2b-256 | 308a3bd2ab18465ad410062aa232d3303f3ad81255ed19f2a8562aa10733202b |
Close
Hashes for pybase16384-0.1.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a26bc287ee30d0cbdda1f69453b11f57e322f3362fa152013235166c7bbbb20a |
|
MD5 | 04bc1af818879cae9ae88bf0bbefeec1 |
|
BLAKE2b-256 | ebec76839b34329aa6447e8fc701e43f74b9628817532a2dc50a86f0b103bb9c |
Close
Hashes for pybase16384-0.1.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 443a1cff9e2b3cf056553607cafb5d57612d7593f8e13313f2cc8f5dff3014af |
|
MD5 | 260c48f89bf0cf7d4859316067a33e8d |
|
BLAKE2b-256 | 77301e2b98c4664e495dd128404fd6c4146146f6dba928ad72e2ed72bee37cff |
Close
Hashes for pybase16384-0.1.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d1629a19fc3d5a36540aa7668eb23a170a49b1af539903b2ce1c884898ee86d |
|
MD5 | 071a596c93f43dd0f00b6275702216ef |
|
BLAKE2b-256 | 31dc161ebf4144ee088b0244a8ea0c7db154ea48d65675e5c863928bbe1a1e22 |
Close
Hashes for pybase16384-0.1.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43ffd06b5ce42d73b1432f01774c548501e055a90dd2e3b5352eca5408afc754 |
|
MD5 | 79eb65f9f196b249e8215d649fcea007 |
|
BLAKE2b-256 | 056872ea537e5e11e7df9c9644aad52be5633f34831040c9c15607f2f3e7af8d |
Close
Hashes for pybase16384-0.1.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27d5ae38b9aafd598884cb1c8a303ec380c5b7d49b62a38acd891eecbc2f3244 |
|
MD5 | fc923203f9b2d62b64948450be94dfe6 |
|
BLAKE2b-256 | bce88175368a48de7a00216965b357e667e0d942aaa09a6c8ddc8238d940ec45 |
Close
Hashes for pybase16384-0.1.1-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a046eb53df440d626437163b588103417b504dda689d2c70be132ac80dc0f98 |
|
MD5 | bbf0dfc2acd22a561671a081f8657c76 |
|
BLAKE2b-256 | 2c258eca64f1659ef5fbb21c6171f69945660ce6a4c4210b2ea4f4f50f1a769e |
Close
Hashes for pybase16384-0.1.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 317bd19acea51fcde9c5bc9ad1c3a8c94abb557e36e20413e419a10e7b8c430c |
|
MD5 | b4585026c72eb06486e88c5fa0a36a1b |
|
BLAKE2b-256 | 175614ef21b519d549411153d05efad17e3e7997214aa7510dcf7dfe6554a1e7 |
Close
Hashes for pybase16384-0.1.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15fb98086e6549ecaaebae87aacc5c2550c214f2a01c636968f1b2cf97227625 |
|
MD5 | 4b76679bd34eee3a4960737453f66cbe |
|
BLAKE2b-256 | 23d9c29a7097d55744aab1ff1272d99f403a87835678b179a6819f234638c3b6 |
Close
Hashes for pybase16384-0.1.1-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3ab1fcba9cb5c215639a09f9ca4524aee1609fdbd0ae0dbb2036ab031f99ac2 |
|
MD5 | 89ebbcf285223b8a89fe814636b05ea3 |
|
BLAKE2b-256 | ce975c2d4ad6517aa8600f1512d8180ee338e0d73e0367d830664110663890c2 |
Close
Hashes for pybase16384-0.1.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf30398c961684e730038232f1cef6033d605c972d4f7846bd5cfff62467a41d |
|
MD5 | 8d7ce6094ff624747054615f6dae73cd |
|
BLAKE2b-256 | a4c9d3b07448ed1437770a4dff8515973539dc6027f120e64dc7ba24633894de |