https://github.com/g-andrade/elixir-ff3-1
Format-preserving encryption for Elixir (FF3-1)
https://github.com/g-andrade/elixir-ff3-1
ff3 format-preserving-encryption fpe
Last synced: 10 months ago
JSON representation
Format-preserving encryption for Elixir (FF3-1)
- Host: GitHub
- URL: https://github.com/g-andrade/elixir-ff3-1
- Owner: g-andrade
- License: mit
- Created: 2023-05-27T18:00:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-01T16:46:42.000Z (over 2 years ago)
- Last Synced: 2025-03-23T21:15:27.207Z (about 1 year ago)
- Topics: ff3, format-preserving-encryption, fpe
- Language: Elixir
- Homepage:
- Size: 348 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# FF3_1: Format-preserving encryption for Elixir
Work in progress to provide format-preserving encryption through the FF3-1 algorithm,
[a revised version of FF3](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38Gr1-draft.pdf)
after security issues were uncovered.
I wrote this for the kicks - it is not a serious project.
```elixir
key = <<
0xAD, 0x41, 0xEC, 0x5D, 0x23, 0x56, 0xDE, 0xAE,
0x53, 0xAE, 0x76, 0xF5, 0x0B, 0x4B, 0xA6, 0xD2
>>
tweak = <<0xCF, 0x29, 0xDA, 0x1E, 0x18, 0xD9, 0x70>>
{:ok, ctx} = FF3_1.new_ctx(key, 10)
assert "4716569208" == FF3_1.encrypt!(ctx, tweak, "6520935496")
assert "6520935496" == FF3_1.decrypt!(ctx, tweak, "4716569208")
```
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `fpe` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ff3_1, "~> 0.1.0"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at .