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.0.1234-cp312-cp312-win_amd64.whl (48.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

marearts_crystal-0.0.1234-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-0.0.1234-cp310-cp310-win_amd64.whl (48.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

marearts_crystal-0.0.1234-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-0.0.1234-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d4b03c06c6276dd92a599e693f94ac60841ed7332382675a460e419bd7ac3e76
MD5 966b7685aeffd445500f4f7d146408f9
BLAKE2b-256 19a3361c7aaa4b24517d669986fd99e4350dccbc3718d8406d62ff7f5452ad63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp312-cp312-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ef2ce1c431b6dbd8e399ef24826ae016440b77324e82dabaea58bee202fb4a37
MD5 219e058456f494dd2b91df7e0df72376
BLAKE2b-256 6c0e3b19dda364672688710e94e52b06e5d688ad1e3551893c80ec26458effcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b48cc49d333c69e834ff8c0f666ea00241dd95b75d8ffe0cc6cd5aea894b4ab0
MD5 fc701ebd4ac2c67f4ff65c0a8ba24dbc
BLAKE2b-256 9325d511c1387dcf6839ff0f28bfc86d0f33e1a61bc1df403f829b8d2302e47b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8345c6511b992a573218ee2f5d22d10e30b864d581954363d570a6dba8eb8e0f
MD5 58aba6b84a0cab45cc1d57831d4c8613
BLAKE2b-256 0f459c5e9a576f76e5debed93685d586145cc393f04ea029582cffa98111b9e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e5b152ca2e822215a8c1962685e449a8e0dd2782e3c6f23cdb858314e5f9d2f2
MD5 3899ab88a79b2c323a3959473ce2f542
BLAKE2b-256 798147e9f157b320e62bbdb081e97883bfd8dfeb55396f298246a4f84725ff51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a2a2d966a4b4cf893b9c6cd397a82fdafb8dd5a0951bacb923375e357a9f7166
MD5 eeaeda9197d0aecfbfc9504173830e5c
BLAKE2b-256 766ced1c3a5a8e3083fdea7fe91fcde0d33decc1093139ff3846eee587c2ff30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1f5e19802d25468d1f2a7b5233ea911be97b9e3b5be28f47b638c76af78afa21
MD5 d94d6a7f99ec01542a730e5f34139dd5
BLAKE2b-256 8c27d5288aa341f01d338bef849d260197396ee707e84d83a2701eca9155e342

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 95f65d43aa15191f4fb20f9999ef1e0c302672aa0700717394f462e45d725384
MD5 161c9d51b0a1ef5856fc105aacee8f49
BLAKE2b-256 02dc1189f55a486ca7455f4888c145b0078b15ea186ea8efbea91a622cbb4aae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for marearts_crystal-0.0.1234-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3430293cf9e6fa1c93df08a03cd1882923f2855d27f716f47ed2b7749e8e1e7f
MD5 e7897bdcd6417d146d7c9dae0cb86eee
BLAKE2b-256 04710104dbd0bf539dfc84efba5b88c2513abcc86caa52c84ec96a7911011174

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