Skip to main content

Stream modern cipher simple application for 2021 year which uses XChaCha20-Poly1305

Project description

Cipher21

Stream cipher simple application for 2021 year which uses XChaCha20-Poly1305

Using XChaCha20-Poly1305 cipher provides:

1. Rationale

Lack of ready to use simple application for encryption with modern cipher.

2. Installation

  • Installed Python 3.6 or higher is required.
  • Type in the console pip3 install cipher21.

3. Usage Guide

  • detailed parameters description: cipher21 -h
  • cipher21 supports 64 hexadecimals keys only which you may create via:
  • encrypting a file with a hex key fetch from a file: cipher21 -e -k file:key.hex < plain.txt > encrypted.c21
  • encrypting a file with a hex key fetch from an env: cipher21 -e -k env:KEY64 < plain.txt > encrypted.c21
  • decrypting a file with a hex key fetch from a file: cipher21 -d -k file:key.hex < encrypted.c21 > plain.txt
  • compressing and encrypting: mysqldump --all-databases | xz -zc | cipher21 -e -k file:key.hex > db-dump.sql.xz.c21
  • decrypting and decompressing: cat db-dump.sql.xz.c21 | cipher21 -d -k file:key.hex | xz -dc | mysql

4. Recommended Designations

  • .c21 is a recommended file name extension
  • application/cipher21 ia a recommended internet media type

5. Technical details

5.1. Stream Structure

  • Stream length must always be a multiple of M == 2^14 == 16384 bytes to hide the exact length of a payload.
 offset | len | description
--------+-----+---------------------------------------------------
      0 |   8 | stream signature: "c21\x1A\x00\xFF\x19\x82"
      8 |  24 | nonce
     32 |   E | XChaCha20-Poly1305 encrypted block (see below)
    -16 |  16 | MAC

constraints:
(8 + 24 + E + 16) % M == 0   =>   E % M == M - 48 == 16336

5.2. Encrypted Block

 offset | len | description
--------+-----+---------------------------------------------
      0 |   8 | little endian unsigned integer of an encryption time in nanoseconds
        |     | since the January 1, 1970, 00:00:00 (UTC), not counting leap seconds
      8 |   D | payload
 -2 - P |   P | randomized padding bytes
     -2 |   2 | little endian unsigned integer P - the padding length

constraints:
(8 + D + P + 2) % M == M - 48
    => (D + P) % M == M - 58
    => P % M == (M - 58 - D) % M
    => P == (2*M - 58 - (D % M)) % M

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

cipher21-0.1.0b1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file cipher21-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: cipher21-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.0

File hashes

Hashes for cipher21-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 d54672f9eeeffb040953c596edb6ffca9074087e0e5a1c6f0a478415148ba3e2
MD5 03775a2ca62bbc5c56bb6e1c03129588
BLAKE2b-256 5afb72c4445a0aad0ffd6e05833977131c70a9bbadc83eafecf82f12df132a7f

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