Documentation ¶
Overview ¶
Package ff3 implements the FF3 format-preserving encryption algorithm/scheme
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrStringNotInRadix is returned if input or intermediate strings cannot be parsed in the given radix ErrStringNotInRadix = errors.New("string is not within base/radix") // ErrTweakLengthInvalid is returned if the tweak length is not 8 bytes ErrTweakLengthInvalid = errors.New("tweak must be 8 bytes, or 64 bits") )
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
A Cipher is an instance of the FF3 mode of format preserving encryption using a particular key, radix, and tweak
func NewCipher ¶
NewCipher initializes a new FF3 Cipher for encryption or decryption use based on the radix, key and tweak parameters.
func (Cipher) Decrypt ¶
Decrypt decrypts the string X over the current FF3 parameters and returns the plaintext of the same length and format
func (Cipher) DecryptWithTweak ¶
DecryptWithTweak is the same as Decrypt except it uses the tweak from the parameter rather than the current Cipher's tweak This allows you to re-use a single Cipher (for a given key) and simply override the tweak for each unique data input, which is a practical use-case of FPE for things like credit card numbers.
func (Cipher) Encrypt ¶
Encrypt encrypts the string X over the current FF3 parameters and returns the ciphertext of the same length and format
func (Cipher) EncryptWithTweak ¶
EncryptWithTweak is the same as Encrypt except it uses the tweak from the parameter rather than the current Cipher's tweak This allows you to re-use a single Cipher (for a given key) and simply override the tweak for each unique data input, which is a practical use-case of FPE for things like credit card numbers.