Skip to main content

Not an encryption tool

Project description

shift

Not an encryption tool

Shift was designed to store non-critical text data in such a way that only keyholders could reconstruct a useful message. Following the cryptography community's rule of "Never roll your own encryption", I am specifically not calling this an encryption tool. I have found that through some basic testing, with a reasonable key, breaking this encoding is not easy for the average teenage 1337 haxxor, but I cannot say anything for it's durability against an experienced code breaker. If you find a way to break this, open up an issue, or contact me via email (any pull requests that can strengthen the tool are welcome too).

This tool is still under development, and may not be backwards compatible with itself in the near future.

Installation

To install this tool and library, use PIP:

# Install shift
pip3 install shift-tool

# Run shift
shift2 -h

NOTE: the executable is named shift2 not shift.

Usage

Commandline

Shift's commandline tool has two modes:

# Encode
shift2 /path/to/input/file your_key_here > output.shift

# Decode
shift2 -d /path/to/encoded/file your_key_here > output.txt

Library

You can also integrate shift2 into your own program with the library that is automatically installed with the commandline tool.

import shift2.crypt as s2c

# Inputs
my_key = "hello_shift"
my_message = "I'm shifty"

# Generate shifted key
key = s2c.key2shifts(my_key)

# Encode the message
data = s2c.encode(my_message, key)

# Print out the encoded message
print(data)

# To decode, just use s2c.decode instead of s2c.encode

Speed

By using Python's cProfile tool, we can see the time required to encode and decode example.txt. This file contains 50 paragraphs generated by lipsum.com, using the key ewpratten:

Encoding:
         117661 function calls (117578 primitive calls) in 0.065 seconds
Decoding:
         151991 function calls (151904 primitive calls) in 0.092 seconds

To run your own speed tests, use the time.sh script.

Querks

The first interesting thing about shift, is that the key can be randomly modified during encoding. This means that the message and key could actually encode eachother (this was done in my first implementation but produced files >1GB from the word "hello")

Binary data must be b64 encoded before being passed through the encoder due to python safety checking unicode data.

Development

Deploying to PIP

To deploy shift to PIP, use:

pip3 uninstall shift-tool
./deploy.sh
pip3 install --no-cache-dir shift-tool

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

shift-tool-3.0.1.tar.gz (4.4 kB view hashes)

Uploaded Source

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