Metadata-Version: 2.1
Name: scodec
Version: 0.0.4
Summary: Spatial encoding algorithm using psuedo hilbert curves
Home-page: https://leapsystems.online
Author: cSDes1gn
Author-email: christian@leapsystems.online
License: UNKNOWN
Download-URL: https://github.com/Incuvers/iris-stage/archive/0.0.1.tar.gz
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Requires-Python: >=3.7.0
Description-Content-Type: text/markdown
Requires-Dist: Cython
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: PyYaml

# Spatial Codec
[![PyPI version](https://badge.fury.io/py/scodec.svg)](https://badge.fury.io/py/scodec)
[![ci](https://github.com/LEAP-Systems/spatial-codec/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/LEAP-Systems/spatial-codec/actions/workflows/ci.yaml)

Modified: 2021-06

<p align="center">
  <img src="docs/img/LEAP_INS_WHITE.png"/>
</p>

## Navigation
  1. [About](#about)
  2. [Quickstart](#quickstart)
  3. [Dev](#dev)
  4. [License](#license)

## About
Spatial codec is a spatial encoding and decoding algorithm developed for iteratively mapping any number of bytes to a 3D (N3 space) matrix. The algorithm uses a psuedo variant of [Hilbert's Space Filling Curve](https://en.wikipedia.org/wiki/Hilbert_curve) which preserves the relative localization of bits in 3D independant of the matrix dimension which is a convienient property for error correction and scalable network policies.

## Quickstart
Install `scodec` from the package index
```bash
python3 -m pip install --upgrade pip
...
python3 -m pip install scodec
```
### API
Spatial codec provides an api for interacting in 2 (`N2`) and 3 (`N3`) dimensional space. Below is an example of using the `N2` space api:
```python
from scodec.n2 import N2

# configure a 2D spatial codec using a 64 bit block size
sc = N2(block_size=64)
# encode utf-8 string and enable matplotlib visualizer
space_encode = sc.stream_encode(bytes("Hello World", "utf-8"), mpl=True)
# feed spatial encode stream back into stream decode
bytestream = sc.stream_decode(space_encode)
```

### CLI Tool
The codec provides a cli tool for ease of use. Run the algorithm for a specified block size `-b` / `--block`, with a data stream `-d` / `--data` and dimension `-n` / `--dimension` (2 or 3). The MPL visualizer can be enabled with the `-v=` flag.
```bash
# n2 codec invocation
python3 -m codec -n 2 -b 512 -d "Hello World" -v=
...
# n3 codec invocation 
python3 -m codec -n 3 -b 8 -d "H" -v=
```

## License
BSD 2-Clause License available [here](LICENSE)


