z-base-32: human-oriented base-32 encoding
Project description
z-base-32
The z-base-32
is a human oriented base32 encoding.
API
The library exposes two functions with following signatures and error type:
pub fn encode(input: &[u8]) -> String;
pub fn decode(input: &str) -> Result<Vec<u8>, DecodeError>;
pub struct DecodeError;
Example
use zbase32::{encode, decode};
fn main() {
assert_eq!(encode(b"foo"), "c3zs6".to_string());
assert_eq!(Ok(b"foo"), decode("c3zs6".to_string()));
assert_eq!(decode(&encode(b"foo")).unwrap(), b"foo")
}
Python
Building
This crate can be compiled with feature flag python
in which case it produces python bindings. To build a Python wheels use maturin
:
maturin build --cargo-extra-args="--features python"
API
def encode(input: bytes) -> str:
def decode(input: str) -> bytes:
class DecodeError(Exception):
Example
import zbase32
assert zbase32.encode(b'foo') == 'c3zs6'
assert zbase32.decode('c3zs6') == b'foo'
try:
zbase32.decode('invalid@char')
except zbase32.DecodeError as e:
print(e)
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
z_base_32-0.1.2.tar.gz
(3.9 kB
view hashes)
Built Distributions
Close
Hashes for z_base_32-0.1.2-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7608ef0f8be0a1e6dc4e943fbe81d88f7afd36f2d79781dc66c533668d13de18 |
|
MD5 | 2ce23e3b8da16a86a1b56d8142d833b1 |
|
BLAKE2b-256 | 265754b7201bef88f7debfeb73c3fc70dc2e8ba7a8b4cc7effcb7599adcf8114 |
Close
Hashes for z_base_32-0.1.2-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 263c67057eb2795b84ff0196503b15c327665ff95ed54f86489af3ed9892a07f |
|
MD5 | 2efa679ecf96f00b62de211a71f6681f |
|
BLAKE2b-256 | 98a8650b99067fd6c673e30a71cab0810fa5a1fdd99abc212de66d823abe9d5c |
Close
Hashes for z_base_32-0.1.2-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d327c46e3e27247db6adeaede974e28b9447eb16c19ba09ec9a5474447e5f808 |
|
MD5 | 4814cb8bf53ea34b30873917f5879bb3 |
|
BLAKE2b-256 | d0c3c5ddfa542d471820354c298e5e08d8bcce53c1246b6fcc782c89e0d90ed1 |
Close
Hashes for z_base_32-0.1.2-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26edc03dbc0a2a08147d0a34ada51c9a48507e5d472b016e9955971d5183cc72 |
|
MD5 | a352071f845e6c5a1137bf943ee31b16 |
|
BLAKE2b-256 | c8647cff420b926d7fb6baaedd85fd041e5ed32b48148252841a9f55adf75b03 |
Close
Hashes for z_base_32-0.1.2-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 595880991fddf2ee6ae9ac2cec6803f88429f4e4067d27197139c9e6b240488a |
|
MD5 | 881acb8e4052c34b14c21c1fd8f63a99 |
|
BLAKE2b-256 | 5b04e8464a34302c8e3f9a93bf1da27f165c77a5de741ac3627200bc92751eaa |
Close
Hashes for z_base_32-0.1.2-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92a84ef1a54e0f0416cd6626990ad348722c0980894cece93c5d0f2e9ee9d475 |
|
MD5 | c384d793385765ebd71e8de563f33dc3 |
|
BLAKE2b-256 | 6b8457131bcf968666a43eb111d1fd658c8a981b207ba2f3d2c3f491bab71bc9 |
Close
Hashes for z_base_32-0.1.2-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38d6a7cbdce631ed6ce7d8bcb6e4ac38309b84f9772798845fa8316a5f443630 |
|
MD5 | 44ea15b151f127a2887d312cbd745339 |
|
BLAKE2b-256 | 0bcea32a7896489bca057df878ee450a64e31ea0b073f5e77b3d9cf50ecc6a4d |
Close
Hashes for z_base_32-0.1.2-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b11c91cf2ec50ffb6abd997d0c3558248526a59fd2ce98e78cc034d1a57cdfde |
|
MD5 | 92503a3bef31125eff291016908398f8 |
|
BLAKE2b-256 | d7509fc477322e2fda4d1f4faae336a6c1dd7fc2e180d894dc821a92706cb774 |
Close
Hashes for z_base_32-0.1.2-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3067328fbafb016b7dc84ec9835394996aabba329e5ef4365ac91a42321e492 |
|
MD5 | 5b6f69495f7176c71df1aabb22bb7eff |
|
BLAKE2b-256 | 90135e9952a5e2a23061b5fdb6d7767d51db78d94092e738eccb1f0358a0b424 |
Close
Hashes for z_base_32-0.1.2-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22acdb74871330be3ae47c42b387a0db9d37bd18c387cc5312916e4a87215bbc |
|
MD5 | 0ab0fbd309eeaaad260b5e57d163b9c9 |
|
BLAKE2b-256 | 70faf3826edab67e553f72d1d8c2aca90b02b0b530352b056f4feca38c862aee |
Close
Hashes for z_base_32-0.1.2-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74147c7e7576da67562643022a4409561ea36a25d805d8915266c9662d95c8f2 |
|
MD5 | 6c7a3c9cabcf0ae9de69788f582abf85 |
|
BLAKE2b-256 | 390d76dfe2c73f0490b5e737eb7764698e6879eb0876a070f77212cdd5477484 |
Close
Hashes for z_base_32-0.1.2-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e7481da54fcba1144321a5e6c43ad480bd6c7c214f5fefd097c0bf853309bfa |
|
MD5 | e498e6313a71925be14f88b6272dd001 |
|
BLAKE2b-256 | 613d48d2b2ce467ba396e614e001be0234cd6b35261875b403b3005f9a55f530 |