Giter Club home page Giter Club logo

byte-spinner's Introduction

ByteSpinner

A Python library and command-line utility to encrypt short plaintext bytes using an enhanced XOR algorithm.

Usage in Python

Generating a new key and testing the encryption:

from ByteSpinner import Spinner

# generate new symmetric key, write to file
sp = Spinner.generate()
f = open('my_secret_key.json', 'w')
f.write(sp.dumps())
f.close()

# encrypt some text
plaintext = bytearray(b'Testing ByteSpinner encryption.')
ciphertext = sp.encrypt(plaintext)
assert plaintext != ciphertext

# decrypt and check
plaintext_check = sp.decrypt(ciphertext)
assert plaintext == plaintext_check

Reading the key and displaying the properties:

from ByteSpinner import Spinner

# read previous key
f = open('my_secret_key.json', 'r')
sp = Spinner.loads(f.read())
f.close()

# print properties
print('XOR base length: %d' % sp.num_bytes)
print('Iterations: %d' % sp.num_iterations)

Usage on the command line

Generating a new key:

bytespinner gen my_secret_key.json

Show key properties:

bytespinner info my_secret_key.json

Encrypt a plaintext file:

echo "Testing ByteSpinner encryption." > plaintext.txt
bytespinner enc my_secret_key.json plaintext.txt ciphertext.out

Decrypt back to plaintext and check the result:

bytespinner dec my_secret_key.json ciphertext.out plaintext_check.txt
diff plaintext.txt plaintext_check.txt

byte-spinner's People

Contributors

jarrodsinclair avatar

Watchers

James Cloos avatar

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.