loongson/pypi/: pybase16384-0.3.4 metadata and description

Homepage Simple index

fast base16384 encode and decode

author synodriver
author_email diguohuangjiajinweijun@gmail.com
classifiers
  • Development Status :: 5 - Production/Stable
  • Operating System :: OS Independent
  • License :: OSI Approved :: GNU General Public License v3 (GPLv3)
  • Topic :: Security :: Cryptography
  • Programming Language :: C
  • Programming Language :: Cython
  • Programming Language :: Python
  • Programming Language :: Python :: 3.6
  • Programming Language :: Python :: 3.7
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: Implementation :: CPython
  • Programming Language :: Python :: Implementation :: PyPy
description_content_type text/markdown
keywords encode,decode,base16384
license GPLv3
requires_dist
  • cffi>=1.0.0
requires_python >=3.6
File Tox results History
pybase16384-0.3.4-cp310-cp310-manylinux_2_28_loongarch64.whl
Size
249 KB
Type
Python Wheel
Python
3.10

✨ pybase16384 ✨

The python binding for base16384

一种神奇的编码

pypi python implementation wheel license action

使用

>>> 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: ...

def encode_local_file(inp: Union[str, bytes, Path], out: Union[str, bytes, Path], encsize: int, decsize: int) -> None: ...

def decode_local_file(inp: Union[str, bytes, Path], out: Union[str, bytes, Path], encsize: int, decsize: int) -> None: ...

def encode_fd(inp: int, out: int) -> None: ...
    
def decode_fd(inp: int, out: int) -> None: ...

内部函数

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: ...

def is_64bits() -> bool: ...

✨ v0.3更新 ✨

融合了 CFFI 版本的成果,现在一个包可以同时在cpython和pypy上运行

本机编译

python -m pip install setuptools wheel cython cffi
git clone https://github.com/synodriver/pybase16384
cd pybase16384
git submodule update --init --recursive
python setup.py bdist_wheel --use-cython --use-cffi

后端选择

默认由py实现决定,在cpython上自动选择cython后端,在pypy上自动选择cffi后端,使用B14_USE_CFFI环境变量可以强制选择cffi