Skip to main content

a Python implementation of TripleSec

Project description

Build Status Coverage Status PyPi version PyPi downloads

A Python port of the TripleSec library. See also the JS implementation.

Compatible with Python 2.6, 2.7 and 3.3.

Installation

pip install TripleSec

Usage

Instantiate a triplesec.TripleSec(key=None) object, with or without a key (if omitted it will have to be specified at each use), then use the encrypt(message, key=None) and decrypt(ciphertext, key=None) methods.

All values must be binary strings (str on Python 2, bytes on Python 3)

Shortcuts

The (unkeyed) functions encrypt and decrypt are exposed at the module level.

Command line tool

TripleSec offers a triplesec command line tool to encrypt and decrypt messages from the terminal.

Here is the help:

Command-line TripleSec encryption-decryption tool

Usage: triplesec {enc|dec} [key] {message|ciphertext}

Both the key and the message can be specified as text or as hex if prepended with 0x
The key, if omitted, will be requested

API

Sphinx documentation coming soon.

Example

>>> import triplesec
>>> x = triplesec.encrypt(b"IT'S A YELLOW SUBMARINE", b'* password *')
>>> print(triplesec.decrypt(x, b'* password *').decode())
IT'S A YELLOW SUBMARINE
>>> from triplesec import TripleSec
>>> T = TripleSec(b'* password *')
>>> x = T.encrypt(b"IT'S A YELLOW SUBMARINE")
>>> print(T.decrypt(x).decode())
IT'S A YELLOW SUBMARINE

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

TripleSec-0.2.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file TripleSec-0.2.tar.gz.

File metadata

  • Download URL: TripleSec-0.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for TripleSec-0.2.tar.gz
Algorithm Hash digest
SHA256 ebc278733f54c1a9bdde3dbe7b347e8653cfe7b412567ec52fb80221e9ec2501
MD5 b925a0b6b489e8667342d047f17d98f2
BLAKE2b-256 d35e0137adb86f53a98ba11656a5a6b9c2bcafbd61b0db2a6e487a03f1145b27

See more details on using hashes here.

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