Skip to content

Commit bd78cef

Browse files
committed
updated example
1 parent bbecab5 commit bd78cef

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Changes to minimum domain size and revised tweak length have been partially impl
1515

1616
## Requires
1717

18-
This project was built and tested with Python 3.7 and later versions. It requires the pycryptodome library:
18+
This project was built and tested with Python 3.6 and later versions. It requires the pycryptodome library:
1919

2020
`pip3 install pycryptodome`
2121

@@ -27,14 +27,25 @@ Install this project with pip:
2727

2828
## Usage
2929

30-
FF3 is a Feistel ciphers, and Feistel ciphers are initialized with a radix representing an alphabet. Practial radix limits of 36 in Java means the following radix values are typical:
30+
FF3 is a Feistel ciphers, and Feistel ciphers are initialized with a radix representing an alphabet.
31+
Practial radix limits of 36 in python means the following radix values are typical:
3132
* radix 10: digits 0..9
3233
* radix 26: alphabetic a-z
3334
* radix 36: alphanumeric 0..9, a-z
3435

35-
Special characters and international character sets, such as those found in UTF-8, would require a larger radix, and are not supported.
36+
Special characters and international character sets, such as those found in UTF-8, would require a larger radix, and are not supported.
37+
Also, all elements in a plaintext string share the same radix. Thus, an identification number that consists of a letter followed
38+
by 6 digits (e.g. A123456) cannot be correctly encrypted by FPE while preserving this convention.
3639

37-
It's important to note that, as with any cryptographic package, managing and protecting the key appropriately to your situation is crucial. This package does not provide any guarantees regarding the key in memory.
40+
Input plaintext has maximum length restrictions based upon the chosen radix (2 * floor(96/log2(radix))):
41+
* radix 10: 56
42+
* radix 26: 40
43+
* radix 36: 36
44+
45+
To work around string length, its possible to encode longer text in chunks.
46+
47+
As with any cryptographic package, managing and protecting the key(s) is crucial. The tweak is generally not kept secret.
48+
This package does not protect the key in memory.
3849

3950
## Code Example
4051

@@ -46,7 +57,7 @@ from ff3 import FF3Cipher
4657

4758
key = "EF4359D8D580AA4F7F036D6F04FC6A94"
4859
tweak = "D8E7920AFA330A73"
49-
c = FF3Cipher(10, key, tweak)
60+
c = FF3Cipher(key, tweak)
5061

5162
plaintext = "4000001234567899"
5263
ciphertext = c.encrypt(plaintext)

0 commit comments

Comments
 (0)