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-0.1.26-cp311-cp311-win_amd64.whl (48.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

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

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

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.1.26-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8c0aa2d9ac70bbd3f6b25fbb9e7d0f6f547d93fff319a6dd6c70c3a2f8354319
MD5 60d62a3ad3b67c139aca1c29751be7be
BLAKE2b-256 b8dbc6196888dfb49e32f8902548336e8c15e8e15a66198dfb91047ee5ca4ff1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.1.26-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5c49e75a49e57d47c977323628761dfb04da51bb3b2fed526abdf93edd5c5a2d
MD5 4b7ca94aa470c843818406b7b546d83e
BLAKE2b-256 8c13d25cb123b3d4e9a6c1a2b4d108874e3bd542c14979a2d6d8b3a05390ff95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.1.26-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e252e565b58e045166b22e3c6fe016e8b016dc33b7cb3804bc1473958af64eb6
MD5 ffcbb28ff9d87eaf81fd0338db94abe2
BLAKE2b-256 be7940685c245920b5d9db4ec99a9b41510e44a20cead82aeb414db76dd578fb

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