loongson/pypi/: pybase16384-0.3.7 metadata and description

Homepage Simple index Mirror page

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.8
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: 3.12
  • 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.7-cp311-cp311-manylinux_2_36_loongarch64.whl
Size
489 KB
Type
Python Wheel
Python
3.11

✨ 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'))

公开函数

from typing import IO

def encode_len(dlen: int) -> int: ...

def decode_len(dlen: int, offset: int) -> int: ...

ENCBUFSZ: int
DECBUFSZ: int
FLAG_NOHEADER: int
FLAG_SUM_CHECK_ON_REMAIN: int
FLAG_DO_SUM_CHECK_FORCELY: int

def is_64bits() -> bool: ...

def encode_file(input: IO, output: IO, write_head: bool = ..., buf_rate: int = ...): ...

def encode_file_safe(input: IO, output: IO, write_head: bool = ..., buf_rate: int = ...): ...

def decode_file(input: IO, output: IO, buf_rate: int = ...): ...

def decode_file_safe(input: IO, output: IO, buf_rate: int = ...): ...

def ensure_bytes(inp) -> bytes: ...

def encode_local_file(inp, out) -> None: ...

def decode_local_file(inp, out) -> None: ...

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

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

def encode_local_file_detailed(inp, out, flag: int) -> None: ...

def decode_local_file_detailed(inp, out, flag: int) -> None: ...

def encode_fd_detailed(inp: int, out: int, flag: int) -> None: ...

def decode_fd_detailed(inp: int, out: int, flag: int) -> None: ...

def encode(data: bytes) -> bytes: ...

def encode_safe(data: bytes) -> bytes: ...

def decode(data: bytes) -> bytes: ...

def decode_safe(data: bytes) -> bytes: ...

def encode_from_string(data: str, write_head: bool = ...) -> bytes: ...

def encode_from_string_safe(data: str, write_head: bool = ...) -> bytes: ...

def encode_to_string(data: bytes) -> str: ...

def encode_to_string_safe(data: bytes) -> str: ...

def encode_string(data: str) -> str: ...

def encode_string_safe(data: str) -> str: ...

def decode_from_bytes(data: bytes) -> str: ...

def decode_from_bytes_safe(data: bytes) -> str: ...

def decode_from_string(data: str) -> bytes: ...

def decode_from_string_safe(data: str) -> bytes: ...

def decode_string(data: str) -> str: ...

def decode_string_safe(data: str) -> str: ...

内部函数

def _encode(data: BufferProtocol) -> bytes: ...

def _encode_safe(data: BufferProtocol) -> bytes: ...

def _decode(data: BufferProtocol) -> bytes: ...

def _decode_safe(data: BufferProtocol) -> bytes: ...

def _encode_into(data: BufferProtocol, dest: BufferProtocol) -> int: ...

def _encode_into_safe(data: BufferProtocol, dest: BufferProtocol) -> int: ...

def _decode_into(data: BufferProtocol, dest: BufferProtocol) -> int: ...

def _decode_into_safe(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