Giter Club home page Giter Club logo

crypto-sim's Introduction

Crypto-sim

Crypto_sim/crypto-sim is a Python library for dealing with cryptography(secure encryption and decryption).

Installation

Use the package manager pip to install crypto-sim.

pip install crypto-sim

Usage

To generate a key

from crypto_sim import crypto

crypto.generate_key()
>>> b'KFH1RhgN_JydLaZzAv6QbpQzsET1SQLjjaFz9dR2-To=' #A key will be returned

To save the key in default dir

from crypto_sim import crypto

crypto.save_and_create_key() #A key will be automatically generate and saved

To get the saved key

from crypto_sim import crypto

crypto.get_key()

Note:- this only works when the save_and_create_key() is used

To encrypt a str

from crypto_sim import

key=crypto.generate_key()
plain_message="hi"
encrypted=crypto.encrypt(plain_message,key)
print(encrypted)

Output:-

>>> b'gAAAAABe7uOq4PYOSe9usicMgivc0oVJWaWBzBQmbZbICgrG7TfbdxK8bIuXqttaw-rnScJBGd2RUxgSaC3_CTK0NwbJS_THJA=='

To decrypt

First, we will execute the above code and then we will get the key and the encrypted message

After that,

# This full code is after the above code
decrypted=crypto.decrypt(encryption,key)
print(decrypted)
plain_message==decrypted

Output:-

>>> hi
>>> True

Links

CODE

LICENSE

See what's new in the next project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.