Skip to main content

A tool library created by jaanca that allows encrypting and decrypting in different ways.

Project description

jaanca public libraries

Package version Python


A tool library created by jaanca

  • Python library: A tool library created by jaanca that allows encrypting and decrypting in different ways.

Source code | Package (PyPI) | Samples


library installation

pip install jaanca-utils-encrypt --upgrade

Example of use

Public and private keys can be generated and saved in text with line separator single_line=False or in a single line with single_line=True.

from jaanca_chronometer import Chronometer
from jaanca_utils_encrypt import EncryptionRSA

chronometer=Chronometer()
single_line=False
encryption_rsa=EncryptionRSA()

chronometer.start()
encrypt_publicKey, decrypt_privateKey = encryption_rsa.create_keys(len_key_in_bits=2048,single_line=single_line)
chronometer.stop()
create_keys=chronometer.get_elapsed_time()

chronometer.start()
plane_text="Hello World"
encrypted_text = encryption_rsa.encrypt_with_private_key_pkcs1(plane_text,encrypt_publicKey)
chronometer.stop()
encrypt_with_private_key_pkcs1=chronometer.get_elapsed_time()

chronometer.start()
decrypted_text = encryption_rsa.decrypt_with_private_key_pkcs1(encrypted_text,decrypt_privateKey)
chronometer.stop()
decrypt_with_private_key_pkcs1=chronometer.get_elapsed_time()

print(f"encrypted_text: {encrypted_text}")
print(f"decrypted_text: {decrypted_text}")
print(f"time elapsed for create_keys: {create_keys}")
print(f"time elapsed for encrypt_with_private_key_pkcs1 {chronometer.get_format_time()}: {encrypt_with_private_key_pkcs1}")
print(f"time elapsed for decrypt_with_private_key_pkcs1 {chronometer.get_format_time()}: {decrypt_with_private_key_pkcs1}")

# Output

# encrypted_text: tIN2dAOFJ+iwhPR2CRlkyPcKQpr5QmPwXGWTJvMVwrh2FTt67dYhbTnte69Tp76v5KlJSaFoXrcge8wNkxrUtR/9hur7RBdtAQrZG+fMsAKrSNYLedfiaYHxcSmgMvx+Bl81YXaSW+dNGkNVJCp92zhAjps0UkB1KVjsEjEH3eFtb+BxY2WikzCHswm47kmNl9yhSMDHsJo3n8zrEA7Ucrge6CtQ4pofswYFEk84lwyaIQWtPO2Tg7IamdO5DYu82zf3heAm+qqhEPNWT9Ua85YyABUF4DDmRRbFYUh2OxsoePZuFhLlg9PAag0M58Dr4I42AkS6Zur5geBptS/mxA==

# decrypted_text: Hello World

# time elapsed for create_keys: 00:00:02
# time elapsed for encrypt_with_private_key_pkcs1 HH:mm:ss: 00:00:00
# time elapsed for decrypt_with_private_key_pkcs1 HH:mm:ss: 00:00:00

Semantic Versioning

jaanca-utils-encrypt < MAJOR >.< MINOR >.< PATCH >

  • MAJOR: version when you make incompatible API changes
  • MINOR: version when you add functionality in a backwards compatible manner
  • PATCH: version when you make backwards compatible bug fixes

Definitions for releasing versions

  • https://peps.python.org/pep-0440/

    • X.YaN (Alpha release): Identify and fix early-stage bugs. Not suitable for production use.
    • X.YbN (Beta release): Stabilize and refine features. Address reported bugs. Prepare for official release.
    • X.YrcN (Release candidate): Final version before official release. Assumes all major features are complete and stable. Recommended for testing in non-critical environments.
    • X.Y (Final release/Stable/Production): Completed, stable version ready for use in production. Full release for public use.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Types of changes

  • Added for new features.
  • Changed for changes in existing functionality.
  • Deprecated for soon-to-be removed features.
  • Removed for now removed features.
  • Fixed for any bug fixes.
  • Security in case of vulnerabilities.

[0.0.1rcX] - 2024-06-05

Added

  • First tests using pypi.org in develop environment.

[0.1.X] - 2024-06-05

Added

  • Completion of testing and launch into production.

Project details


Download files

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

Source Distribution

jaanca_utils_encrypt-0.1.0.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

jaanca_utils_encrypt-0.1.0-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

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