Skip to main content

py-shannon

PyPI Code style: black

Pure Python implementation of Shannon stream cipher. No-brainer port of shannon.

Shannon cipher is used in Spotify Connect to encrypt communication between player and Spotify AP server. Shannon cipher is variant of Sober stream cipher.

Example

Encryption

from shannon import Shannon

key = b"\x65\x87\xd8\x8f\x6c\x32\x9d\x8a\xe4\x6b"
message = "My secret message".encode("utf-8")

shannon = Shannon(key)

message = shannon.encrypt(message)  # -> bytes
# message contains ciphertext now
mac = shannon.finish()  # -> bytes
# mac contains MAC of the message

Decryption

from shannon import Shannon

key = b"\x65\x87\xd8\x8f\x6c\x32\x9d\x8a\xe4\x6b"
# message is encrypted
message = b"\x91\x9d\xa9\xb6\x29\xfc\x9c\xdd\x17\x8c\x15\x31\x9a\xae\xcc\x6e\xd4"
received_mac = b"\xbe\x7b\xef\x39\xee\xfe\x54\xfd\x8d\xb0\xbc\x6f\xd5\x30\x35\x19"

shannon = Shannon(key)
message = shannon.decrypt(message)  # -> bytes
# message contains plaintext now
mac = shannon.finish()
if mac == received_mac:
    print("MAC OK")

Metadata

Release files for py-shannon 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-shannon 1.0.1
File Size Uploaded Provenance
py-shannon-1.0.1.tar.gz 4.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for py-shannon 1.0.1
File Interpreter ABI Platform
py_shannon-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / py-shannon-1.0.1.tar.gz

Download URL py-shannon-1.0.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
95c3e02716ee18e5ff2013c5cd22fe73bad9c81c403ee4c70c7f5cfdf06ec4db
BLAKE2b-256 checksum
How to use checksums
faa2aaa04676cbfc69dd08dbebd6719bc78daf7678e491c266e2df279c3ad17c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Release files / py_shannon-1.0.1-py3-none-any.whl

Download URL py_shannon-1.0.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18804d13ade7b510bf41c02880c785933ea733fd74d8e4c69f6d6a7bf536af92
BLAKE2b-256 checksum
How to use checksums
53854c6db48bca49de779811e0b2d7e4ece0f8aa2a5e494e744188b6fec571cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Security for py-shannon 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page