Skip to content

Me1onRind/goffx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goffx

goffx is a pure go implementation of Format-preserving, Feistel-based encryption (FFX) from https://github.com/emulbreh/pyffx.

Only support sha1 at present. It's no difficult to add other encryption algorithms.

Usage

package main

import (
    "fmt"

    "github.com/Me1onRind/goffx"
)

func main() {
    ie := goffx.Integer("secret-key", 4)
    fmt.Println(ie.Encrypt(1234)) // output 6103 <nil>
    fmt.Println(ie.Decrypt(6103)) // output 1234 <nil>

    se := goffx.String("secret-key", "abc", 6)
    fmt.Println(se.Encrypt("aaabbb")) // output "acbacc" <nil>
    fmt.Println(se.Decrypt("acbacc")) // output "aaabbb" <nil>
}

About

pure go format preserving encryption

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages