2022-01-23 14:24:05 +00:00
# Enchantrix
2025-11-13 20:31:44 +00:00
[](https://goreportcard.com/report/github.com/Snider/Enchantrix)
[](https://godoc.org/github.com/Snider/Enchantrix)
[](https://github.com/Snider/Enchantrix/actions/workflows/go.yml)
2025-11-02 22:14:04 +00:00
[](https://codecov.io/github/Snider/Enchantrix)
2025-11-13 20:31:44 +00:00
[](https://github.com/Snider/Enchantrix/releases/latest)
[](https://github.com/Snider/Enchantrix/blob/main/LICENCE)
2026-01-13 16:10:30 +00:00
[](https://go.dev/)
2025-11-02 22:14:04 +00:00
2026-01-13 16:10:30 +00:00
A Go-based encryption and data transformation library designed for secure handling of sensitive data. Enchantrix provides composable transformation pipelines, a flexible binary container format, and defense-in-depth encryption with pre-obfuscation.
2022-01-23 14:24:05 +00:00
2026-01-13 16:10:30 +00:00
## Features
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
- **Sigil Transformation Framework** - Composable, reversible data transformations (encoding, compression, hashing)
- **Pre-Obfuscation Layer** - Side-channel attack mitigation for AEAD ciphers
- **.trix Container Format** - Protocol-agnostic binary format with JSON metadata
- **Multiple Hash Algorithms** - SHA-2, SHA-3, BLAKE2, RIPEMD-160, and the custom LTHN algorithm
- **Full PGP Support** - Key generation, encryption, decryption, signing, and verification
- **RSA Operations** - Key generation, encryption, and decryption
- **CLI Tool** - `trix` command for encoding, decoding, and transformations
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
## Quick Start
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
### Installation
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
```shell
go get github.com/Snider/Enchantrix
2025-11-04 11:27:35 +00:00
```
2026-01-13 16:10:30 +00:00
### Install CLI Tool
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
```shell
go install github.com/Snider/Enchantrix/cmd/trix@latest
```
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
### Basic Usage
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
#### Sigil Transformations
2022-01-23 21:49:14 +00:00
2026-01-13 16:10:30 +00:00
```go
package main
2022-01-23 21:49:14 +00:00
2026-01-13 16:10:30 +00:00
import (
"fmt"
"github.com/Snider/Enchantrix/pkg/enchantrix"
)
2022-01-23 21:49:14 +00:00
2026-01-13 16:10:30 +00:00
func main() {
// Create sigils
hexSigil, _ := enchantrix.NewSigil("hex")
base64Sigil, _ := enchantrix.NewSigil("base64")
2022-01-23 21:49:14 +00:00
2026-01-13 16:10:30 +00:00
// Apply transformations
data := []byte("Hello, Enchantrix!")
encoded, _ := enchantrix.Transmute(data, []enchantrix.Sigil{hexSigil, base64Sigil})
fmt.Printf("Encoded: %s\n", encoded)
}
2025-10-30 17:11:31 +00:00
```
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
#### Hashing
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
```go
package main
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
import (
"fmt"
"github.com/Snider/Enchantrix/pkg/crypt"
)
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
func main() {
service := crypt.NewService()
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
hash := service.Hash(crypt.SHA256, "Hello, World!")
fmt.Printf("SHA-256: %s\n", hash)
// LTHN quasi-salted hash
lthnHash := service.Hash(crypt.LTHN, "Hello, World!")
fmt.Printf("LTHN: %s\n", lthnHash)
}
2025-11-03 04:05:32 +00:00
```
2026-01-13 16:10:30 +00:00
#### Encrypted .trix Container
```go
package main
import (
"fmt"
"github.com/Snider/Enchantrix/pkg/trix"
)
func main() {
container := & trix.Trix{
Header: map[string]interface{}{
"content_type": "text/plain",
"created_at": "2025-01-13T12:00:00Z",
},
Payload: []byte("Secret message"),
InSigils: []string{"gzip", "base64"},
}
// Pack with sigils
container.Pack()
// Encode to binary
encoded, _ := trix.Encode(container, "MYAP", nil)
fmt.Printf("Container size: %d bytes\n", len(encoded))
}
```
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
### CLI Examples
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
```shell
# Encode with sigils
echo "Hello, Trix!" | trix encode --output message.trix --magic TRIX base64
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
# Decode
trix decode --input message.trix --output message.txt --magic TRIX base64
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
# Hash data
echo "Hello, World!" | trix hash sha256
# Apply sigil directly
echo "Hello" | trix hex
# Output: 48656c6c6f
2025-11-03 04:05:32 +00:00
```
2026-01-13 16:10:30 +00:00
## Specifications
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
Enchantrix includes formal RFC-style specifications for its core protocols:
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
| RFC | Title | Description |
|-----|-------|-------------|
| [RFC-0001 ](rfcs/RFC-0001-Pre-Obfuscation-Layer.md ) | Pre-Obfuscation Layer | Side-channel mitigation for AEAD ciphers |
| [RFC-0002 ](rfcs/RFC-0002-Trix-Container-Format.md ) | TRIX Container Format | Binary container with JSON metadata |
| [RFC-0003 ](rfcs/RFC-0003-Sigil-Transformation-Framework.md ) | Sigil Framework | Composable data transformation interface |
| [RFC-0004 ](rfcs/RFC-0004-LTHN-Hash-Algorithm.md ) | LTHN Hash | Quasi-salted deterministic hashing |
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
## Available Sigils
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
| Category | Sigils |
|----------|--------|
| **Encoding** | `hex` , `base64` |
| **Compression** | `gzip` |
| **Formatting** | `json` , `json-indent` |
| **Transform** | `reverse` |
| **Hashing** | `md4` , `md5` , `sha1` , `sha224` , `sha256` , `sha384` , `sha512` , `sha3-224` , `sha3-256` , `sha3-384` , `sha3-512` , `sha512-224` , `sha512-256` , `ripemd160` , `blake2s-256` , `blake2b-256` , `blake2b-384` , `blake2b-512` |
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
## Project Structure
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
```
Enchantrix/
├── cmd/trix/ # CLI tool
├── pkg/
│ ├── enchantrix/ # Sigil framework and crypto sigils
│ ├── trix/ # .trix container format
│ └── crypt/ # Cryptographic services (hash, RSA, PGP)
├── rfcs/ # Protocol specifications
├── examples/ # Usage examples
└── docs/ # MkDocs documentation
2025-11-03 04:05:32 +00:00
```
2026-01-13 16:10:30 +00:00
## Documentation
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
Full documentation is available via MkDocs:
2025-11-03 04:05:32 +00:00
```shell
2026-01-13 16:10:30 +00:00
# Install dependencies
pip install mkdocs mkdocs-material
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
# Serve locally
mkdocs serve -a 127.0.0.1:8000
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
# Build static site
mkdocs build --strict
2025-11-03 04:05:32 +00:00
```
2026-01-13 16:10:30 +00:00
## Development
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
### Requirements
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
- Go 1.25 or later
2025-11-03 04:05:32 +00:00
2026-01-13 16:10:30 +00:00
### Running Tests
2025-11-03 04:05:32 +00:00
```shell
2026-01-13 16:10:30 +00:00
# Run all tests
go test ./...
# Run with race detection
go test -race ./...
# Run with coverage
go test -coverprofile=coverage.out ./...
2025-11-03 04:05:32 +00:00
```
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
### Test-Driven Development
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
This project follows strict TDD methodology. All new functionality must include comprehensive tests.
2025-11-04 11:27:35 +00:00
2026-01-13 16:10:30 +00:00
## Releases
Built with GoReleaser:
2025-11-04 11:27:35 +00:00
```shell
2026-01-13 16:10:30 +00:00
# Snapshot release (local, no publish)
2025-11-04 11:27:35 +00:00
goreleaser release --snapshot --clean
2026-01-13 16:10:30 +00:00
# Production release (requires Git tag)
2025-11-04 11:27:35 +00:00
goreleaser release --clean
```
2026-01-13 16:10:30 +00:00
## License
See [LICENCE ](LICENCE ) for details.