Skip to main content

Squeak library

Project description

squeak

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


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.9.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

squeaklib-0.9.1-py2.py3-none-any.whl (19.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file squeaklib-0.9.1.tar.gz.

File metadata

  • Download URL: squeaklib-0.9.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for squeaklib-0.9.1.tar.gz
Algorithm Hash digest
SHA256 c410d6fae6d5f8a43af5148a9790b82cfa883512f18fd3bde5d2f00f7e41aaa8
MD5 bc277317b97bf27a5a44d7d1fb8a1678
BLAKE2b-256 0fb36821c2e3219a72e66ac5a5f70df4304d72884bb99c6ff73ea33f99a7c0c8

See more details on using hashes here.

Provenance

File details

Details for the file squeaklib-0.9.1-py2.py3-none-any.whl.

File metadata

  • Download URL: squeaklib-0.9.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for squeaklib-0.9.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b7b7bf472e0baffece63aae249b22cd9ba05200a312e37fa74efe1a5c7742514
MD5 4d4f0e9fd6e5c265e3914a14915eeab3
BLAKE2b-256 1973614c408a7ea0617fa8976fa159535c3ea136fd44ddf4c34b9e911269b667

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page