Skip to content

Commit e961d59

Browse files
committedMay 13, 2021
Abandon ancient approach to generating docs
1 parent fc894e6 commit e961d59

11 files changed

+51
-108
lines changed
 

‎.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ erl_crash.dump
1414
logs
1515
_build
1616
.idea
17-
doc/overview.edoc

‎Makefile

+11-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,17 @@ dialyzer: $(REBAR3)
3838
xref: $(REBAR3)
3939
@$(REBAR3) xref
4040

41-
doc: build
42-
./scripts/hackish_inject_version_in_docs.sh
43-
./scripts/hackish_make_docs.sh
41+
doc: $(REBAR3)
42+
@$(REBAR3) edoc
43+
44+
README.md: doc
45+
# non-portable dirty hack follows (pandoc 2.1.1 used)
46+
# gfm: "github-flavoured markdown"
47+
@pandoc --from html --to gfm doc/overview-summary.html -o README.md
48+
@tail -n +11 <"README.md" >"README.md_"
49+
@head -n -12 <"README.md_" >"README.md"
50+
@tail -n 2 <"README.md_" >>"README.md"
51+
@rm "README.md_"
4452

4553
test: $(REBAR3)
4654
@$(REBAR3) eunit

‎README.md

+29-46
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,66 @@
1+
# erlffx
12

3+
-----
24

3-
# erlffx #
5+
`erlffx` is an Erlang implementation of the mechanism described in the
6+
2010 paper [The FFX Mode of Operation for Format-Preserving
7+
Encryption](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.304.1736&rep=rep1&type=pdf)
8+
by Bellare, Rogaway and Spies. It is based on an existing [Java
9+
implementation](https://github.com/michaeltandy/java-ffx-format-preserving-encryption)
10+
by Michael Tandy.
411

5-
Copyright (c) 2017-2021 Guilherme Andrade
12+
\* AES-128 / AES-192 (only Erlang 19 and up) / AES-256 keys are
13+
supported (CBC mode) \* Any positive word length is supported \* Any
14+
radix / alphabet size between 2 and 255 is acceptable (10 by default) \*
15+
Optional 'tweak' values may be defined \* Number of rounds is
16+
configurable (10 by default)
617

7-
__Version:__ 1.1.1
18+
The code was successfully tested on generations 17, 18 and 19 of
19+
Erlang/OTP; the unit tests themselves were written using the following
20+
lists of test vectors: \* [AES FFX Test Vector
21+
Data](http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/aes-ffx-vectors.txt)
22+
\* [FF1
23+
samples](http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/FF1samples.pdf)
824

9-
__Authors:__ Guilherme Andrade ([`erlffx(at)gandrade(dot)net`](mailto:erlffx(at)gandrade(dot)net)).
10-
11-
`erlffx`: Format Preserving Encryption - FFX for Erlang
12-
13-
14-
---------
15-
16-
`erlffx` is an Erlang implementation of the mechanism described in the 2010 paper [The FFX Mode of Operation for Format-Preserving Encryption](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.304.1736&rep=rep1&type=pdf) by Bellare, Rogaway and Spies. It is based on an existing [Java implementation](https://github.com/michaeltandy/java-ffx-format-preserving-encryption) by Michael Tandy.
17-
18-
* AES-128 / AES-192 (only Erlang 19 and up) / AES-256 keys are supported (CBC mode)
19-
* Any positive word length is supported
20-
* Any radix / alphabet size between 2 and 255 is acceptable (10 by default)
21-
* Optional 'tweak' values may be defined
22-
* Number of rounds is configurable (10 by default)
23-
24-
The code was successfully tested on generations 17, 18 and 19 of Erlang/OTP; the unit tests themselves were written using the following lists of test vectors:
25-
* [AES FFX Test Vector Data](http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/aes-ffx-vectors.txt)
26-
* [FF1 samples](http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/FF1samples.pdf)
27-
28-
29-
### <a name="Examples">Examples</a> ###
30-
31-
32-
```erlang
25+
### <span id="Examples">Examples</span>
3326

27+
``` erlang
3428
% AES-128 CBC / 10-digit decimal words
3529
AesKey = <<43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60>>,
3630
ValueLength = 10,
3731
Config = erlffx:config(AesKey, ValueLength).
3832

3933
Encrypted = erlffx:encrypt(Config, 123456789). % 2433477484
4034
Decrypted = erlffx:decrypt(Config, Encrypted). % 123456789
41-
4235
```
4336

44-
---------
45-
46-
```erlang
37+
-----
4738

39+
``` erlang
4840
% AES-128 CBC / 10-digit decimal words / custom tweak
4941
AesKey = <<43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60>>,
5042
ValueLength = 10,
5143
Config = erlffx:config(AesKey, ValueLength, #{ tweak => "9876543210" }).
5244

5345
Encrypted = erlffx:encrypt(Config, 123456789). % 6124200773
5446
Decrypted = erlffx:decrypt(Config, Encrypted). % 123456789
55-
5647
```
5748

58-
---------
59-
60-
```erlang
49+
-----
6150

51+
``` erlang
6252
% AES-128 CBC / 16-digit base-36 words / custom tweak
6353
AesKey = <<43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60>>,
6454
ValueLength = 16,
6555
Config = erlffx:config(AesKey, ValueLength, #{ tweak => "TQF9J5QDAGSCSPB1", radix => 36 }).
6656

6757
Encrypted = erlffx:encrypt(Config, 36#C4XPWULBM3M863JH). % 36#C8AQ3U846ZWH6QZP
6858
Decrypted = erlffx:decrypt(Config, Encrypted). % 36#C4XPWULBM3M863JH
69-
7059
```
7160

72-
---------
73-
74-
```erlang
61+
-----
7562

63+
``` erlang
7664
% AES-256 CBC / 6-digit binary words
7765
AesKey = <<43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60,
7866
239,67,89,216,213,128,170,79,127,3,109,111,4,252,106,148>>,
@@ -81,13 +69,8 @@ Config = erlffx:config(AesKey, ValueLength, #{ radix => 2 }).
8169

8270
Encrypted = erlffx:encrypt(Config, 2#000001). % 2#100100
8371
Decrypted = erlffx:decrypt(Config, Encrypted). % 2#000001
84-
8572
```
8673

74+
-----
8775

88-
## Modules ##
89-
90-
91-
<table width="100%" border="0" summary="list of modules">
92-
<tr><td><a href="https://github.com/g-andrade/erlffx/blob/master/doc/erlffx.md" class="module">erlffx</a></td></tr></table>
93-
76+
*Generated by EDoc*

‎doc/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

‎doc/overview-summary.html

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
<body bgcolor="white">
99
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
1010
<h1>erlffx</h1>
11-
<p>Copyright © 2017-2021 Guilherme Andrade</p>
12-
<p><b>Version:</b> 1.1.1</p>
13-
<p><b>Authors:</b> Guilherme Andrade (<a href="mailto:erlffx(at)gandrade(dot)net"><tt>erlffx(at)gandrade(dot)net</tt></a>).</p>
14-
<p><code>erlffx</code>: Format Preserving Encryption - FFX for Erlang</p>
11+
1512

1613
<hr>
1714

@@ -28,7 +25,7 @@ <h1>erlffx</h1>
2825
* <a href="http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/FF1samples.pdf">FF1 samples</a></p>
2926

3027
<h3><a name="Examples">Examples</a></h3>
31-
<pre lang="erlang">
28+
<pre lang="erlang" class="erlang">
3229
% AES-128 CBC / 10-digit decimal words
3330
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60&gt;&gt;,
3431
ValueLength = 10,
@@ -40,7 +37,7 @@ <h3><a name="Examples">Examples</a></h3>
4037

4138
<hr>
4239

43-
<pre lang="erlang">
40+
<pre lang="erlang" class="erlang">
4441
% AES-128 CBC / 10-digit decimal words / custom tweak
4542
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60&gt;&gt;,
4643
ValueLength = 10,
@@ -52,7 +49,7 @@ <h3><a name="Examples">Examples</a></h3>
5249

5350
<hr>
5451

55-
<pre lang="erlang">
52+
<pre lang="erlang" class="erlang">
5653
% AES-128 CBC / 16-digit base-36 words / custom tweak
5754
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60&gt;&gt;,
5855
ValueLength = 16,
@@ -64,7 +61,7 @@ <h3><a name="Examples">Examples</a></h3>
6461

6562
<hr>
6663

67-
<pre lang="erlang">
64+
<pre lang="erlang" class="erlang">
6865
% AES-256 CBC / 6-digit binary words
6966
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60,
7067
239,67,89,216,213,128,170,79,127,3,109,111,4,252,106,148&gt;&gt;,

‎overview.edoc ‎doc/overview.edoc

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
@author Guilherme Andrade <erlffx(at)gandrade(dot)net>
2-
@copyright 2017-2021 Guilherme Andrade
3-
@version 1.1.1
41
@title erlffx
5-
@doc `erlffx': Format Preserving Encryption - FFX for Erlang
2+
@doc
63

74
<hr/>
85

@@ -19,7 +16,7 @@ The code was successfully tested on generations 17, 18 and 19 of Erlang/OTP; the
1916
* <a href="http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/FF1samples.pdf">FF1 samples</a>
2017

2118
== Examples ==
22-
<pre lang="erlang">
19+
<pre lang="erlang" class="erlang">
2320
% AES-128 CBC / 10-digit decimal words
2421
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60&gt;&gt;,
2522
ValueLength = 10,
@@ -31,7 +28,7 @@ Decrypted = erlffx:decrypt(Config, Encrypted). % 123456789
3128

3229
<hr/>
3330

34-
<pre lang="erlang">
31+
<pre lang="erlang" class="erlang">
3532
% AES-128 CBC / 10-digit decimal words / custom tweak
3633
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60&gt;&gt;,
3734
ValueLength = 10,
@@ -43,7 +40,7 @@ Decrypted = erlffx:decrypt(Config, Encrypted). % 123456789
4340

4441
<hr/>
4542

46-
<pre lang="erlang">
43+
<pre lang="erlang" class="erlang">
4744
% AES-128 CBC / 16-digit base-36 words / custom tweak
4845
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60&gt;&gt;,
4946
ValueLength = 16,
@@ -55,7 +52,7 @@ Decrypted = erlffx:decrypt(Config, Encrypted). % 36#C4XPWULBM3M863JH
5552

5653
<hr/>
5754

58-
<pre lang="erlang">
55+
<pre lang="erlang" class="erlang">
5956
% AES-256 CBC / 6-digit binary words
6057
AesKey = &lt;&lt;43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60,
6158
239,67,89,216,213,128,170,79,127,3,109,111,4,252,106,148&gt;&gt;,

‎scripts/hackish_inject_version_in_docs.sh

-5
This file was deleted.

‎scripts/hackish_make_docs.sh

-11
This file was deleted.

‎scripts/requirements.txt

-1
This file was deleted.

‎scripts/version_from_git.py

-19
This file was deleted.

‎scripts/version_from_git.sh

-6
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.