aesffx

package module
v0.0.0-...-84f15fd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2015 License: MIT Imports: 9 Imported by: 0

README

perm-crypt

A Golang implementation of the AES-FFX Format-Preserving Encryption Scheme

Installation

$ go get github.com/roasbeef/perm-crypt

Example Usage

key, _ := hex.DecodeString("2b7e151628aed2a6abf7158809cf4f3c")

tweak := []byte("9876543210")

plainString := "0123456789"

ffx, _ := aesffx.NewCipher(10, key, tweak)

cipher, _ := ffx.Encrypt(plainString)

plain, _ := ffx.Decrypt(cipher)
	

WARNING: You probably shouldn't use this in a production environment. This lib was created primarily as yak-shaving for a research project.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FFXCipher

type FFXCipher struct {
	// contains filtered or unexported fields
}

FFXCipher represents the parameters needed for AES-FFX.

func NewCipher

func NewCipher(radix uint32, key, tweak []byte) (*FFXCipher, error)

NewCipher creates a new cipher capable of encrypting and decrypting messages using the AES-FFX mode for format-preserving encryption.

func (FFXCipher) Decrypt

func (f FFXCipher) Decrypt(src string) (string, error)

Decrypt decrypts the given ciphertext, producing plaintext output.

func (FFXCipher) Encrypt

func (f FFXCipher) Encrypt(src string) (string, error)

Encrypt encrypts the given plaintext, producing ciphertext output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL