Squeak library
Project description
squeak
Python library for Squeak protocol.
Requirements
- python3
Test
make test
Install
pip install squeaklib
Examples
Create a squeak, verify its signature with the public key, and decrypt the content:
import time
from bitcoin.core import lx
from squeak.core import CheckSqueak
from squeak.core import MakeSqueakFromStr
from squeak.core.keys import SqueakPrivateKey
private_key = SqueakPrivateKey.generate()
block_height = 0
block_hash = lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b')
content = "Hello world!"
timestamp = int(time.time())
squeak, secret_key = MakeSqueakFromStr(
private_key,
content,
block_height,
block_hash,
timestamp,
)
CheckSqueak(squeak) # No exception raised
print(squeak.GetHash()) # prints b"\x9e\xeb\xbc)N\x94\xe2\x85\x9b(d\x7f\x1e7\xb5{\xcbY\xef\xd4;\xf7P\xfe\x19'Q\xb7\x7f\xbda\xaf"
print(squeak.GetPubKey()) # prints SqueakPublicKey('02d2fe30552bb5ec3b6822cec25b7dd7d4163974e28f2f4ef40d1f9d09086704c6')
print(squeak.GetDecryptedContentStr(secret_key)) # Hello world!
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
squeaklib-0.13.0.tar.gz
(10.6 kB
view details)
Built Distribution
File details
Details for the file squeaklib-0.13.0.tar.gz
.
File metadata
- Download URL: squeaklib-0.13.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eee6331cbeeb083a176ddbdd0a65b4a22bda39d4a2c2177822bc5b48e688403e |
|
MD5 | 8faa897422d4ab2077602a5068e1b1ff |
|
BLAKE2b-256 | 8b8f32f6d500c2167262a77735f3cd9a00067fe15b009e63013b07138513af13 |
Provenance
File details
Details for the file squeaklib-0.13.0-py2.py3-none-any.whl
.
File metadata
- Download URL: squeaklib-0.13.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af99ca8e6249ed47e288931ebea45bc64fb89fe98676a8e568641bcd5a60bc6e |
|
MD5 | 04620ad4e47aa67668a4001d68816873 |
|
BLAKE2b-256 | 860c5a7a75da7c925817480cfb845a34d90566b733cd24af5f7a4a51d3fdd9ec |