Skip to main content

Python encryption bluepy.

Project description

Python Bluepoint Encryption

Full symetric block cypher encryption algorythm

Quick example:

    import bluepyenc
    buff = "Hello, this is a test string.";
    passw = "1234"                          # This is a test
    enc = bluepyenc.encrypt(buff, passw)
    dec = bluepyenc.decrypt(enc, passw)
    assert buff == dec

The power of the encryption comes from the following primitives: (implemented as 'C' macros)

    HECTOR(op)              use op with vector highs
    PASSLOOP(op)            use op with pass as vector
    FWLOOP(op)              forward loop traverse
    FWLOOP2(op)             forward loop variation
    BWLOOP(op)              backward loop
    BWLOOP2(op)             backward loop variation
    MIXIT(op)               mix op on first part with second part
    MIXITR(op)              mix op on first part with second part reverse
    MIXIT2(op)              mix op on first part with second part variation
    MIXIT2R(op)             mix op on first part with second part variation in reverse
    MIXIT4(op)              mix quarter length

These are then added into encrypt operations. Please note that the parameter op is a mathematical / logical operation. (plus, minus, xor ...) The decryption is done in reverse order and reverse operator. (ex: '+' -> '-')

The power comes from the arbitrary order of operators and the arbitrary injection of reversible mathematical / logical operators.

Bluepy has the following operator stack:

Encryption:

PASSLOOP(+)
MIXIT2(+)   MIXIT2R(+)
HECTOR(+)   FWLOOP(+)
MIXIT2(+)   MIXIT2R(+)
PASSLOOP(+) FWLOOP(+)
HECTOR(+)   FWLOOP(+)
MIXITR(+)
BWLOOP(+)   HECTOR(+)

Decryption:

HECTOR(-)   BWLOOP2(-)
MIXITR(-)
FWLOOP2(-)  HECTOR(-)
FWLOOP2(-)  PASSLOOP(-)
MIXIT2R(-)  MIXIT2(-)
FWLOOP2(-)  HECTOR(-)
MIXIT2R(-)  MIXIT2(-)
PASSLOOP(-)

The resulting bit propagation is such high quality, that a single bit change in the original text will change every byte in the resulting block. (see bit description study in the code's directory)

One may create a custom encryption by altering the operator stack in the 'C' source.

This beats current industrial strength encryptions, and perhaps qualifies for the quantum challenge.

Decryption is done by applying the ops in reverse, both by order and meaning. This is very apparent in the functions ENCRYPT() and DECRYPT(). (see source)

Encryption quality test:

The cyphertext is tested for randomness with the 'dieharder' suite. All tests are passed. Below, is an extract of the utility's printout.

   diehard_birthdays|   0|       100|     100|0.07973936|  PASSED
      diehard_operm5|   0|   1000000|     100|0.22646819|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.62699248|  PASSED
    diehard_rank_6x8|   0|    100000|     100|0.66828243|  PASSED
   diehard_bitstream|   0|   2097152|     100|0.55151892|  PASSED
        diehard_opso|   0|   2097152|     100|0.04670626|  PASSED
        diehard_oqso|   0|   2097152|     100|0.06864521|  PASSED
         diehard_dna|   0|   2097152|     100|0.72141254|  PASSED
diehard_count_1s_str|   0|    256000|     100|0.68376408|  PASSED

The bluefile encryption / decryption utility

This utility can be used as a quick command line encryption / decryption utility. One of encrypt / decrypt must be specified.

    Usage: bluefile.py [-e] [-d] [options] fromfile tofile
    Specify -e for encrypt -d decrypt
    Options:    -p pass   - pass to use
                -f        - force overwrite
                -v        - Verbose
                -V        - Print version
                -q        - Quiet
                -h        - Help

TODO;

Started the virtual machine operation, where the encryption is run through a virtual machine stack, following a pre-made recipe or getting hints from the password.

History:

Release                 Thu 13.Oct.2022
Pip install             Sat 03.Jan.2026
Published on GH         Sun 04.Jan.2026

Warning!

No meta data is stored. It is left up to the caller to maintain integrity beyond the cyphertext operations.

The encryption / decryption has to run with the same vector, same pass same block length. Make sure you know what you are doing, as it is all too easy to encrypt something into oblivion.

EOF

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

bluepyenc-1.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bluepyenc-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (32.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file bluepyenc-1.1.0.tar.gz.

File metadata

  • Download URL: bluepyenc-1.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for bluepyenc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 dcb6a243de6618d68bfb8ca82d9882d2ea2383592648f983ae074c11866e96fd
MD5 e205d2fe3cfe896f22dcf3787d9c0fab
BLAKE2b-256 5cddf985e1f48d1659190b08baf2976d00385b5e856446cec3d3514c4c4dfe82

See more details on using hashes here.

File details

Details for the file bluepyenc-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for bluepyenc-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7615a51d2b640c7edeba3dcf5abb71a81cbaef0854676108641d23fa96b0e5bc
MD5 5833525c49eae2b134baf2fdbd1ab716
BLAKE2b-256 46a0c7910f97f16d7cda179b0e3eccb50eeab97be27038b8164fa35be0374ee0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page