Skip to main content

marearts crystal for encryption and decryption

Project description

MareArts Crystal

PyPI Python versions Downloads License

Python encryption library for software licensing and data protection. Simple, fast, and cross-platform.

🎯 Core Features

  • Software Licensing - Generate and validate time-limited license keys with signatures
  • File Encryption - Protect any file type with filename-based encryption
  • Data Security - Encrypt strings, configs, and binary data with one line of code

💡 Why MareArts Crystal?

  • Simple - Just pip install marearts-crystal and start coding
  • Fast - Cython-compiled for C++ performance
  • Compatible - Python 3.9-3.12, Windows/macOS/Linux
  • Proven - Used in production by real businesses

Installation

pip install marearts-crystal

Requirements: Python 3.9-3.12, Windows/macOS/Linux

Quick Start

License Key Generation

from marearts_crystal import ma_crystal

mask = ma_crystal("your-company-secret")

# Generate license key with signature
today = mask.get_today_date()  # "2025-09-12"
expire = mask.generate_end_date(years=1)  # "2026-09-12"
license_key, signature = mask.generate_serial_key("customer@email.com", today, expire)

print(f"License Key: {license_key}")
# Output: License Key: MAEV2:gAAAAABow91CXuG7dJR3eAWpEXj67RP-qboPAHiDGpVfd2dGN5yBXp...

print(f"Signature: {signature}")
# Output: Signature: a21521da5beb6d7c

# Validate license
result = mask.validate_serial_key("customer@email.com", license_key)
if result:
    start_date, end_date, signature = result
    # start_date = "2025-09-12", end_date = "2026-09-12", signature = "a21521da5beb6d7c"
    if mask.validate_date(start_date, end_date):
        print(f"✅ License active until {end_date}")
        # Output: ✅ License active until 2026-09-12
# Using signature for tracking
license_db = {}  # Your database

# Store license with signature
license_key, signature = mask.generate_serial_key("user@email.com", today, expire)
license_db[signature] = {
    "email": "user@email.com",
    "key": license_key,
    "created": today
}

# Later, verify and track
result = mask.validate_serial_key("user@email.com", license_key)
if result:
    start, end, sig = result
    print(f"License {sig} is valid")  # Use signature as ID

File Encryption

# Encrypt file
with open("document.pdf", "rb") as f:
    file_data = f.read()  # Read original file (e.g., 241979 bytes)

encrypted = mask.encrypt_data(file_data)
print(f"Encrypted size: {len(encrypted)} bytes")
# Output: Encrypted size: 322724 bytes

with open("document.pdf.enc", "wb") as f:
    f.write(encrypted)

# Decrypt file
with open("document.pdf.enc", "rb") as f:
    encrypted_data = f.read()

decrypted = mask.decrypt_data(encrypted_data)
print(f"Decrypted size: {len(decrypted)} bytes")
# Output: Decrypted size: 241979 bytes (matches original)

with open("document_decrypted.pdf", "wb") as f:
    f.write(decrypted)
print("✅ File successfully decrypted")
# Output: ✅ File successfully decrypted

More Examples

Python Examples (View on GitHub)

  • License key generation and validation
  • File encryption/decryption
  • Config file encryption
  • License manager class implementation
  • Password vault implementation
  • All API methods demonstration

Jupyter Notebook (Interactive Tutorial)

  • Interactive step-by-step tutorial
  • Visual output of each operation
  • Real-time testing environment

API Reference

Basic Methods

Method Description Example
generate_serial_key(username, start_date, end_date) Generate a license key with signature key, signature = mask.generate_serial_key("user", "2025-09-10", "2025-12-31")
validate_serial_key(username, serial_key) Validate a license key result = mask.validate_serial_key("user", key) # Returns (start_date, end_date, signature)
encrypt_string(text) Encrypt text encrypted = mask.encrypt_string("secret")
decrypt_string(encrypted) Decrypt text text = mask.decrypt_string(encrypted)
encrypt_data(bytes) Encrypt binary data encrypted = mask.encrypt_data(b"data")
decrypt_data(encrypted) Decrypt binary data data = mask.decrypt_data(encrypted)

Utility Methods

Method Description Example
get_today_date() Get today's date (YYYY-MM-DD) today = mask.get_today_date()
generate_end_date(years, months, days) Calculate future date expire = mask.generate_end_date(years=1)
validate_date(start, end) Check if current date is in range valid = mask.validate_date("2025-09-10", "2025-12-31")
is_v2_serial_key(key) Check if key uses V2 format is_v2 = mask.is_v2_serial_key(key)
is_v2_data(data) Check if data uses V2 encryption is_v2 = mask.is_v2_data(data)
string_to_secret_key(input_string) Derive key from string key = mask.string_to_secret_key("password")
secret_key_to_string(secret_key, encrypted) Decrypt with provided key text = mask.secret_key_to_string(key, encrypted)

🔗 MareArts AI Package Family

MareArts Crystal is part of our comprehensive AI and utility package ecosystem:

Package Description Use Case
marearts-anpr 🚗 License Plate Recognition Vehicle identification, parking systems, traffic monitoring
marearts-road-objects 🛣️ Road Object Detection Traffic analysis, smart city applications, safety systems
marearts-crystal 🔐 Encryption & Licensing Software licensing, data security, key management
marearts-xcolor 🎨 High-performance color extraction Color detection apps, dominant color query systems

Support

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

marearts_crystal-2.4.2-cp312-cp312-win_amd64.whl (82.9 kB view details)

Uploaded CPython 3.12Windows x86-64

marearts_crystal-2.4.2-cp312-cp312-manylinux2014_x86_64.whl (646.0 kB view details)

Uploaded CPython 3.12

marearts_crystal-2.4.2-cp312-cp312-manylinux2014_aarch64.whl (628.4 kB view details)

Uploaded CPython 3.12

marearts_crystal-2.4.2-cp312-cp312-macosx_10_13_universal2.whl (195.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

marearts_crystal-2.4.2-cp311-cp311-win_amd64.whl (84.8 kB view details)

Uploaded CPython 3.11Windows x86-64

marearts_crystal-2.4.2-cp311-cp311-manylinux2014_aarch64.whl (674.4 kB view details)

Uploaded CPython 3.11

marearts_crystal-2.4.2-cp311-cp311-manylinux1_x86_64.whl (107.4 kB view details)

Uploaded CPython 3.11

marearts_crystal-2.4.2-cp311-cp311-macosx_10_9_universal2.whl (198.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

marearts_crystal-2.4.2-cp310-cp310-win_amd64.whl (84.0 kB view details)

Uploaded CPython 3.10Windows x86-64

marearts_crystal-2.4.2-cp310-cp310-manylinux2014_aarch64.whl (622.8 kB view details)

Uploaded CPython 3.10

marearts_crystal-2.4.2-cp310-cp310-manylinux1_x86_64.whl (529.0 kB view details)

Uploaded CPython 3.10

marearts_crystal-2.4.2-cp310-cp310-macosx_10_9_universal2.whl (198.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

marearts_crystal-2.4.2-cp39-cp39-win_amd64.whl (94.8 kB view details)

Uploaded CPython 3.9Windows x86-64

marearts_crystal-2.4.2-cp39-cp39-manylinux2014_aarch64.whl (620.0 kB view details)

Uploaded CPython 3.9

marearts_crystal-2.4.2-cp39-cp39-manylinux1_x86_64.whl (536.3 kB view details)

Uploaded CPython 3.9

marearts_crystal-2.4.2-cp39-cp39-macosx_10_9_universal2.whl (199.1 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file marearts_crystal-2.4.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c947355ddc8e8e21982d1791d09245dafb9cdd8469d3e0e10069dfe1795fed6b
MD5 6f7ffe8fd3f26add81242ce0b58646b5
BLAKE2b-256 df184a36353d3411ddaeb42840e35b0c6ec127616dfca9ae7029d810279428dd

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a1b4c36b2d8c83dfc6da30465c68cfdb1121ec83b7dadae87d8d1fd774edbc1
MD5 a3b83188f76d21570b17fdfcf3bdea55
BLAKE2b-256 b8b47c2e9dd2a52a4a9bda11d4f8142d507f1cf6985f0b4cbaaf3e50a31b7af7

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 23a574cfb55fa7c1b497d736d63a34294c42e2675f6a6152872dbfa2893c69ae
MD5 6140e857ad3837aefde337494475c16f
BLAKE2b-256 c838524ca2786a66c0da84369e1fd268157ac48f0c293bed22905c8f3b963d07

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 8a974511b856257493d17a53c3312ac11775b1907b10cdbfa83398f403cfdc3b
MD5 8739c07c86bfa9b7c5a41f698cbeabe0
BLAKE2b-256 9509c36a495e4fdb776b6b60ddaa78e0a2925d4517dc7ffed7fa577ec262da22

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0108e4cd9354926f502152a52c761aa351e079b09417e254800c2f355b6e31e5
MD5 16380faa02dfdfc8075a92136384f4a6
BLAKE2b-256 e7a600d1ed66efcd0baeb5cda061d26393afefb9faebc1faf6339e4711e9d3a0

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bd5824e9d6622477517773c0f5db473be2fa239891e4c59b198540e4ad44f116
MD5 3769a0dfb4f121131fd59391f46bc8f2
BLAKE2b-256 ad289ed663c174fae803167f2699f82e92485f1ccfdd36e29f0e3ff52e97e7dd

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp311-cp311-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cd6b534c733b791de10e7b2be94619a41e1aa1166aaa5b7e60ae2985e095d00b
MD5 78743b8ccb75609124846fe777a28dce
BLAKE2b-256 d263e1a60c76abe9d9225ece10820c08cf636b7af6909b398800172d327308ed

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 4c717ad8fc9352b03804067a5a477795ca3b5a0a3a0a51f6707319ecddd6cc48
MD5 ca29396d42cb2212bd5fd672d252b6aa
BLAKE2b-256 778f20071101ff507937d0cea0e63e92b3d702035b403ed2e68d3d1a7296d8e9

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 51ed982cee1079734f0b53d302d648bd1981f50ae76679c52905694c7b4874eb
MD5 18b99b95f2b71ef58c8debd1ad19c4b1
BLAKE2b-256 95d66e35e0b0f242ccb28e4868bc010bfa9775f119c3634118a8b14122ed9ded

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb08cad44d850295edf8ca113bfc9a8a08b465a87030e58e8e6e84bb9456703b
MD5 2beb576aebbab1f50d2c3eb7cb963900
BLAKE2b-256 f5119a3cc9c1507d1ed06b85e4ad3eb81056e20b540741866f3c2f30ccc33727

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1dcf378d473222d19e298d2141164eca071c391be210f4c61350874a4b54f20f
MD5 5652392da03b43298b49658d86f19ca3
BLAKE2b-256 8479ffc4d664b8fe45267d5274b9eba493f5cd218dcc9c66b613e9a7e3387b2e

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ab4fb0e00705b2f3b7bf6e9b9d98db83f5af7f1ef7a4fccfb6178ccfa473b85c
MD5 0611b2708d91c4198a102cec15198c48
BLAKE2b-256 94fa46e7a2644d46334179ce51e4fc1b113f25ae2e30cc65b47716553d166da8

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 be0b270fea8c2bdf2e99bf5821fcc81b4e9fcf769f62456a9e6303875d3fae57
MD5 deb87baae9fe8fc68fe3aaf939eb3434
BLAKE2b-256 e9608c9d8990139aefd00a84400658365e15ae382820fefba88aa2a1686c6e2e

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aafd3c5a3b7d545d1dd6704a88e3fb6597a31ae0189d0a02be5331adf83aae3b
MD5 cc80b91859a1025dea3fb1a91ef7d09c
BLAKE2b-256 5d8dd81abde4825f5001f9d8627e067d9d739180e039fb75213f9c103f460eed

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp39-cp39-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 661f46cd5c4991bab17755e52309d562f1c0e751acc44cfcd165f0962c8c9ae6
MD5 a0bbdfa2eae3e5499b892a6b25f915b1
BLAKE2b-256 a0fbdd46664280d3aacdadb94d4d3c2534ee3b19fc52f0797153f147226ff7f3

See more details on using hashes here.

File details

Details for the file marearts_crystal-2.4.2-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for marearts_crystal-2.4.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5277e6283d8c66e0ee2991cc5b08bbbe1505e5f0b6cdf469009555ad6878bb1a
MD5 f5d8d22ce830f5e09e9d73c23bc07aa7
BLAKE2b-256 7c3997bf8aed3f879ea6afa94c95204004c083fe2a3aff9d924b8ad437ec6208

See more details on using hashes here.

Supported by

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