Powerful little-endian base-128 encoding/decoding library for Python 3.
Project description
pyleb128
Powerful little-endian base-128 encoding/decoding library for Python 3.
Supports the following types:
- Unsigned LEB128
- Signed LEB128
- Unsigned LEB128 +1 (ULEB128P1)
Example Usage
from pyleb128 import uleb128, sleb128
# unsigned
print(uleb128.decode(b'\xff\xff\x03')) # 65535
print(uleb128.decode(b'\xff\xff\x03').encoded) # b'\xff\xff\x03'
print(uleb128.decode(b'\xff\xff\x03', p1 = True)) # decode with as ULEB128P1
# signed
print(sleb128.decode(b'\xf3\xff\xff\xff\x0f')) # -13
print(uleb128.decode(b'\xf3\xff\xff\xff\x0f').encoded) # b'\xf3\xff\xff\xff\x0f'
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
pyleb128-0.1.2.tar.gz
(14.9 kB
view hashes)
Built Distribution
pyleb128-0.1.2-py3-none-any.whl
(15.5 kB
view hashes)