Coder Social home page Coder Social logo

rostok2112 / cryptopie Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 71 KB

Encryptor, decryptor, encoder and decoder with implemented collection of cryptography and encoding algorithms and CLI interface

License: Apache License 2.0

Python 100.00%
cli python encryption encryption-algorithms encryption-decryption encryption-tool decryption decryption-tool decryption-algorithms substitution-cipher additive-cipher additive-stream-cipher ceasar-cipher rsa-algorithm rsa-cryptography s-des

cryptopie's Introduction

CryptoPie

Encryptor, decryptor, encoder and decoder with implemented collection of cryptography and encoding algorithms and CLI interface

GitHub license

Requirements

  • Python3
  • Optionally:
    • PipEnv

Dependencies installation

If you have pipenv you can install or update dependencies by:

pipenv sync

Else:

pip install -r requirements.txt

Install new dependencies if you have pipenv:

pipenv install <name_of_package>
pipenv requirements > requirements.txt

Else:

pip install <name_of_package>
pip freeze > requirements.txt

Usage

CryptoPie

usage: python crypto_pie.py [-h] {encrypt,decrypt} [-p [PATHES ...]] [-d DESTINATION] [-r] [-k KEY] [-b [BORDERS ...]]
                         [-e {utf-8, ascii, ...}]
                         {ceasar,replacement,additive_stream,s-des-block,rsa} ... input [input ...]

Encryptor/Decryptor/Encoder/Decoder with CLI interface

positional arguments:
  {encrypt,decrypt,generate_key,encode,decode}     List of purposes handlers
    encrypt             Encrypt options
      options:
        -h, --help            show help message
        -p [PATHES ...], --pathes [PATHES ...]
                              A path/pathes to a file/files/directory/directories
        -d DESTINATION, --destination DESTINATION, --dest DESTINATION
                              Destination path
        -r, --recursively     Recursively encrypt/decrypt everuthing in input path. Doesnt do anything if file on input
        -v, --verbose         Print results into stdout
        -k KEY, --key KEY     The value by which an input will be encrypted/decrypted
        -g, --generate_key  Generate random key
        -b [BORDERS ...], --borders [BORDERS ...]
                              Alphabet/alphabets borders in format: a-z A-Z а-я А-Я
        -e {utf-8, ascii, ...}, --encoding {utf-8, ascii, ...}
                              Encoding of texts of input and output files
    decrypt             Decrypt options
      options:
        -h, --help            show help message
        -p [PATHES ...], --pathes [PATHES ...]
                              A path/pathes to a file/files/directory/directories
        -d DESTINATION, --destination DESTINATION, --dest DESTINATION
                              Destination path
        -r, --recursively     Recursively encrypt/decrypt everuthing in input path. Doesnt do anything if file on input
        -v, --verbose         Print results into stdout
        -k KEY, --key KEY     The value by which an input will be encrypted/decrypted
        -b [BORDERS ...], --borders [BORDERS ...]
                              Alphabet/alphabets borders in format: a-z A-Z а-я А-Я
        -e {utf-8, ascii, ...}, --encoding {utf-8, ascii, ...}
                              Encoding of texts of input and output files
    generate_key             Decrypt options
      options:
        -h, --help            show help message
        -l LENGTH_KEY, --length_key LENGTH_KEY     
                              Specify length of random key
        -b [BORDERS ...], --borders [BORDERS ...]
                              Alphabet/alphabets borders in format: a-z A-Z а-я А-Я
    encode
      options:
        -e {utf-8, ascii, ...}, --encoding {utf-8, ascii, ...}
        -p [PATHES ...], --pathes [PATHES ...]
                        A path/pathes to a input file/files/directory/directories
        -r, --recursively     Recursively encrypt/decrypt everuthing in input path. Doesnt do anything if file on input
        -d DESTINATION, --destination DESTINATION, --dest DESTINATION
                        Destination path
        -h, --help  show this help message and exit
    decode
      options:
        -e {utf-8, ascii, ...}, --encoding {utf-8, ascii, ...}
        -p [PATHES ...], --pathes [PATHES ...]
                        A path/pathes to a input file/files/directory/directories
        -r, --recursively     Recursively encrypt/decrypt everuthing in input path. Doesnt do anything if file on input
        -d DESTINATION, --destination DESTINATION, --dest DESTINATION
                        Destination path
        -v, --verbose         Print results into stdout
        -h, --help  show this help message and exit
  {ceasar,substitution,additive_stream,s-des-bloc,rsa}   A cryptographic algorithm for encryption/decryption
    ceasar 
      key format:
        integer_num,  -inf <= integer_num <= inf
        May be any positive or negative integer
    substitution
      key format:
        value_to_be_replaced1:value_to_replace1,value_to_be_replaced2:value_to_replace1,...
        Sequence of pairs of values to be replace and values to replace and values to be replaced by this value
    additive_stream
      options:
        -l LENGTH_KEY, --length_key LENGTH_KEY     
                              Specify length of random key
      key format:
        interval_to_encrypt1:interval1_key1,interval1_key2,interval1_key3,...;interval_to_encrypt2:interval2_key1,interval2_key2,interval2_key3,...;... interval_to_encrypt1 - in format a-z, A-Z; 0 <=interval_key <= length of interval
        Sequence of pairs of intervals to encrypt and sequence of keys for encryption. The length of keys sequence must be greater than 3 or equal to count + 1 of characters if count is lesser than 3. It is best if the length of the keys sequence is equal to the count of characters of the input text
    s-des-block
    rsa
  {b64,}   An encoding/decoding algorithm 
options:
        -h, --help            show help message

Use by:

cd src/
python crypto_pie.py [purpose] [method] [options] <input>

Or if pipenv installed:

pipenv run crypto_pie [purpose] [method] [options] <input>

Diffie Hellman algorithm

usage: python diffie_hellman.py [-h] {get-public-key,get-joint-key} ...

Diffie Hellman protocol

positional arguments:
  {get-public-key,get-joint-key}
                        Generate public key or generate joint key
    get-public-key      Generate public key of this user by given/generated public prime number, public primitive root of this prime number and privite key of this user
      options:
        -h, --help            show this help message and exit
        -gp, --generate-prime-number
                              Generate random public prime number
        -gr, --generate-primitive-root
                              Generate first public primitive root for given/generated prime number
        -gk, --generate-privite-key
                              Generate privite key
        -p PRIME_NUMBER, --prime-number PRIME_NUMBER
                              Public prime number
        -r PRIMITIVE_ROOT, --primitive-root PRIMITIVE_ROOT
                              Public primitive root for given prime number
        -k PRIVITE_KEY, --privite-key PRIVITE_KEY
                              Privite key (1 <= privite_key <= given prime number - 1)
    get-joint-key       Get joint with other user key by public key of other user, public prime number and privite key of this user
      options:
        -h, --help            show this help message and exit
        -p PRIME_NUMBER, --prime-number PRIME_NUMBER
                              Public prime number
        -pvk PRIVITE_KEY, --privite-key PRIVITE_KEY
                              Privite key of this user
        -pbk PUBLIC_KEY, --public-key PUBLIC_KEY
                              Public key of other user

options:
  -h, --help            show this help message and exit

Use by:

cd src/
python diffie_hellman.py [purpose] [options]

Or if pipenv installed:

pipenv run diffie_hellman [purpose] [options] 

cryptopie's People

Contributors

rostok2112 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

no0b3r

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.