Skip to main content

A next-gen Python object serialization suite using the Discrete Fourier Transform

Project description

DFTSerialize™

DFTSerialize™ Logo

DFTSerialize™ is a next-generation data encoding and serialization system designed for Python 3.0 and aboveDFTSerialize™ uses a highly-customized algorithm that encodes any and all (most) Python data structures as bytes, and can even function on RAW BYTES.

Features

  • Snappy and efficient encoding of most Python objects and raw binary data
  • Equally efficient decoding of the output to recover original Python objects or binary data
  • Uses a BUNCH of fancy math and has its own reimplementation of many standard library functions for maximum effectiveness
  • Has a really cool logo

Why

Current serialization systems are stagnant and obsolete. Underutilization of the advantages of floating point processing and mathematical techniques like curve-fitting and function transforms. DFTSerialize™ aims to fix all this.

We noticed that in quantum mechanics, which has many applications in faster computing, there are a lot of these things called "waveforms". So we did some digging and discovered that these were actually wavy functions, and that the parameters of these functions could even be used to reconstruct data! Additionally, these waveforms are probably easier to compute on quantum computers because of the fact that they're both wavy and stuff.

Upon further research, we discovered that JPEG images already use a wavy-function based compression algorithm called the "discrete cosine transform", but when we looked that up it seemed pretty hard so we had our accountants make us another one called the "discrete Fourier transform." We think it's way more marketable since it has a French guy's name in it.

Usage

To use DFTSerialize™, simply install it to your Python version 3.5 or higher using the PIP package manager, like so:

pip install dftserialize

Then, import it in your project. It contains four functions, two for serialization, two for deserialization, of both Python objects and binary data.

Example:

from dftserialize import *

for i in range(30):
    # data = b'x\xda\xe3e@\x02K&:\xc0\x987>$\xcev\xad7w8e\xd6k\xa1ef\xe6\x10U\x91\xa0\xa4...
    data = dft_serialize_data(b"Hello, World!")
    # b"Hello, World!"
    print(dft_deserialize_data(data))

    # true
    assert {1: 2, 3: 4} == dft_deserialize_object(dft_serialize_object({1: 2, 3: 4}))

Speed

DFTSerialize™ is extremely fast and robust! For testing, I took a 7 MB image file and attempted to run it directly through a raw serialization. It didn't finish since I eventually had to shut my computer off, but the point is that it was working.

Reducing the data size down to a 2kb file allowed DFTSerialize™ to completely encode the file in just under 10 minutes, a milestone achievement.

DFTSerialize™ Algorithm

DFTSerialize™ uses a patented[citation needed] algorithm utilizing a near-magical combination of the discrete Fourier transform, floating point math, and even on-the-fly calculation of mathematical constants like pi.

DFTSerialize™ serialization follows a simple set of steps

  1. Pass raw bytes into an FFT

  2. Pack DFT coefficients

  3. Wait around for a second or two so it seems like we have something to do

DFTSerialize™ deserialization follows a similar set of steps, in inverse:

  1. Unpack DFT coefficients

  2. Perform an Inverse DFT

  3. Are we done? Maybe? Anybody?

  4. Wipe all drives if the user isn't satisfied by now

Credits

The idea for the DFTSerialize™ library came in the form of an escalating series of Reddit posts eventually culminating in the use of an inverse DFT to decode text from a series of complex coefficients.

License

DFTSerialize™ is released under the GNU GPL v3 License. Please refer to the LICENSE file that accompanies this project for more information including complete terms and conditions.

Serious Note

This project is a complete and utter joke and should never, ever be used for anything. In fact, I challenge you to find an actual use for this software. Actually, I double challenge you to also push this to production right before you quit your job, and then send me the results.

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

dftserialize-0.2.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

dftserialize-0.2.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file dftserialize-0.2.0.tar.gz.

File metadata

  • Download URL: dftserialize-0.2.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for dftserialize-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7c5e771951641d0a83a719c0696fdc241ec9d46cf2560f5515882fe068e9e302
MD5 a9b5fcdee061abbb548590591e6204ab
BLAKE2b-256 83bf59a10cfcf5d727c82269e044add51499e9767681b64e62ce2e41dc52e490

See more details on using hashes here.

File details

Details for the file dftserialize-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dftserialize-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for dftserialize-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb8cc8adf868147abab7f37aafae4e7ede05abf4aa6b72793d9846846c70c586
MD5 6a3cf4be425cc1f8a35f5d7060616481
BLAKE2b-256 38bbe741cb0b63ad857eb656e20eeff553410a6b0dee52a740426a1c54556755

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