Skip to main content

marearts crystal for encryption and decryption

Project description

MareArts Crystal

MareArts Crystal is a Python package for encryption, decryption, and serial key management. It provides a simple interface for generating and validating serial keys, encrypting and decrypting strings and files, and performing date-based operations.

Installation

Install MareArts Crystal using pip:

pip install marearts-crystal

Usage

Here's a comprehensive guide on how to use MareArts Crystal:

from marearts_crystal import ma_crystal

# Initialize with a secret key
secret_key = "your_secret_key_here"
skm = ma_crystal(secret_key)

# Generate a serial key
username = "john_doe"
start_date = "2023-07-01"
end_date = "2023-12-31"
serial_key = skm.generate_serial_key(username, start_date, end_date)
print(f"Generated Serial Key: {serial_key}")

# Validate the serial key
validated_start, validated_end = skm.validate_serial_key(username, serial_key)
print(f"Validated Start Date: {validated_start}")
print(f"Validated End Date: {validated_end}")

# Date validation
if skm.validate_date("2024-07-01", "2024-12-31"):
    print("Date range is valid")
else:
    print("Date range is invalid")

# Get today's date
print("Today's date:", skm.get_today_date())

# Generate end dates
print("Tomorrow:", skm.generate_end_date(0, 0, 1))
print("Next month:", skm.generate_end_date(0, 1, 0))
print("Next year:", skm.generate_end_date(1, 0, 0))

# Try with an invalid key
invalid_result = skm.validate_serial_key(username, "invalid_key")
print(f"Invalid Key Result: {invalid_result}")

invalid_result = skm.validate_serial_key("wrong_name", serial_key)
print(f"Invalid Key Result: {invalid_result}")

# String encryption and decryption
original_string = "Hello, MareArts Crystal!"
encrypted = skm.encrypt_string(original_string)
print(f"Encrypted: {encrypted}")

decrypted = skm.decrypt_string(encrypted)
print(f"Decrypted: {decrypted}")

# Decryption with wrong key
wrong_key = "wrong_secret_key"
wrong_skm = ma_crystal(wrong_key)
wrong_decryption = wrong_skm.decrypt_string(encrypted)
print(f"Decryption with wrong key: {wrong_decryption}")

# File encryption and decryption
input_filename = "example.bin"  # This can be any file, binary or text
output_encrypted_filename = "example_encrypted.bin"

# Read and encrypt the file
with open(input_filename, "rb") as file:
    file_content = file.read()
encrypted_content = skm.encrypt_data(file_content)

# Save the encrypted content
with open(output_encrypted_filename, "wb") as file:
    file.write(encrypted_content)
print(f"File '{input_filename}' has been encrypted and saved as '{output_encrypted_filename}'")

# Decrypt the file
input_encrypted_filename = output_encrypted_filename
output_decrypted_filename = "example_decrypted.bin"

# Read and decrypt the file
with open(input_encrypted_filename, "rb") as file:
    encrypted_content = file.read()
decrypted_content = skm.decrypt_data(encrypted_content)

if decrypted_content:
    # Save the decrypted content
    with open(output_decrypted_filename, "wb") as file:
        file.write(decrypted_content)
    print(f"File '{input_encrypted_filename}' has been decrypted and saved as '{output_decrypted_filename}'")
else:
    print("Decryption failed. The file might be corrupted or the wrong key was used.")

Features

  • Serial key generation and validation
  • Date validation and manipulation
  • String encryption and decryption
  • File encryption and decryption
  • Secure key management

License

This project is licensed under the MIT License

Support

www.marearts.com

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

marearts_crystal-1.0.1-cp312-cp312-win_amd64.whl (48.0 kB view details)

Uploaded CPython 3.12 Windows x86-64

marearts_crystal-1.0.1-cp312-cp312-macosx_10_9_universal2.whl (101.1 kB view details)

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

marearts_crystal-1.0.1-cp311-cp311-win_amd64.whl (48.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

marearts_crystal-1.0.1-cp311-cp311-macosx_10_9_universal2.whl (100.3 kB view details)

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

marearts_crystal-1.0.1-cp310-cp310-win_amd64.whl (48.6 kB view details)

Uploaded CPython 3.10 Windows x86-64

marearts_crystal-1.0.1-cp310-cp310-macosx_10_9_universal2.whl (100.5 kB view details)

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

File details

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

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a290ea405fa417861cf657bda2f76ba38bc32b74d5edea3430b4ad232464cf80
MD5 58c2913850804411fc06f99cef4ee36e
BLAKE2b-256 f86f3ed4e0bf3ed96c3903f7056ddae3d6f9953071b76bdd949a1e8a701c7cc2

See more details on using hashes here.

File details

Details for the file marearts_crystal-1.0.1-cp312-cp312-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp312-cp312-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 895c19a0f8d68b8681e819c4080f961d7afdbcd17eb968b1bdfef361b5010915
MD5 ec7e953754415065b52091f764a776ec
BLAKE2b-256 bfab9d96550efd564e93b8b25cd1c575467b0cdc344fae6d1ce3b3fdbe332f6b

See more details on using hashes here.

File details

Details for the file marearts_crystal-1.0.1-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5dffb6c93c2b55ff392242d403a2acef482f79423655411e3e149a32a41cfae5
MD5 7d99e1158d43f227c3ddca4230566930
BLAKE2b-256 e6c860d590c24ef17399007a35d81ef729bceab4dd816acc3e8ed37e1d187ab7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a459924e90ee80147cd2c5c609d984c36b78cd97c0281f80dc67e1bacd06041b
MD5 0bdb15a8b364b6109385a32a1f8de400
BLAKE2b-256 b679c3dd8cb398be58ea22d9f6d9859c54d5236f36577e3fd33490e61c63f6f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b1e0568023b49355e2c8a9518b9ceb9ad0dec57e41bdd39f9b3a31346a4dda93
MD5 68566c3a998b7ae60b9c3a4e13715caa
BLAKE2b-256 55f095826bd37d8849b7acc6bdcbbd8f32b59b14cfea9b11a9a644d188416d6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3b02d6f7b01c732e199bac90f4c910085f132ce353d3db0c64ba97e562e84ea6
MD5 92cb2c28cbf0b51f70840e48cdeaac26
BLAKE2b-256 5b71fe3dd235b717a76276a46bf199e151e3ae067eb06d0a132d874276d87fe6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 973be5a84c64cbc978289be32e298e84634b096589cb92bfa573d33fafe0c040
MD5 6ce4759fec87be4147b85589ed6f5496
BLAKE2b-256 0e08fddb475436167cb321f6c7ee7f27603947d58e4fdd0cfc4e130b56cc2c0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dd63b4d047365b930d68a1dd39a9caba5ab4fffc9da1cbfbaf7436d7aa013f54
MD5 8925b6a85dd90465d4862c7de492c22e
BLAKE2b-256 8a7de8d5f8f7f79eb5e45162cebd873721c1da16f8c55e668b63b23e56a31aed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-1.0.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ecedcff30765e3d624d62e5e2e5e5c26dadcb8c715ee5b5db578bbd179484522
MD5 ba6075d10d75757ae84d2e04c7721cd5
BLAKE2b-256 a9bd91c6ee9ca48ab094f22596fb3eef274ef8933d4a6dbea1919bb733c40033

See more details on using hashes here.

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