Skip to content

Commit 1c1cc8d

Browse files
committed
Nits
1 parent 4ed6836 commit 1c1cc8d

File tree

8 files changed

+42
-31
lines changed

8 files changed

+42
-31
lines changed

www/_implementations/dart.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: implementation
33
title: IPCrypt Dart Implementation
4-
description: Dart implementation of IPCrypt supporting all three encryption modes with native Dart SDK.
4+
description: Dart implementation of IPCrypt supporting all four encryption modes with native Dart SDK.
55
permalink: /implementations/dart/
66
language: Dart
77
repository: https://github.com/elliotwutingfeng/ipcrypt
@@ -122,7 +122,7 @@ examples:
122122

123123
## IPCrypt Dart Implementation
124124

125-
A Dart implementation of IPCrypt that provides IP address encryption and obfuscation methods following the IPCrypt specification. This implementation supports all three encryption modes and is designed for native Dart applications.
125+
A Dart implementation of IPCrypt that provides IP address encryption and obfuscation methods following the IPCrypt specification. This implementation supports all four encryption modes and is designed for native Dart applications.
126126

127127
## Installation
128128

@@ -146,11 +146,12 @@ dart pub get
146146

147147
## Usage
148148

149-
The Dart implementation provides three encryption methods as global functions:
149+
The Dart implementation provides encryption methods as global functions:
150150

151151
1. `ipCryptDeterministic` - Deterministic encryption using AES-128
152-
2. `ipCryptNonDeterministic` - Non-deterministic encryption using KIASU-BC
153-
3. `ipCryptExtendedNonDeterministic` - Extended non-deterministic encryption
152+
2. `ipCryptPrefixPreserving` - Prefix-preserving encryption using dual AES-128
153+
3. `ipCryptNonDeterministic` - Non-deterministic encryption using KIASU-BC
154+
4. `ipCryptExtendedNonDeterministic` - Extended non-deterministic encryption
154155

155156
### Deterministic Encryption
156157

www/_implementations/python.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: implementation
33
title: IPCrypt Python Implementation
4-
description: Reference implementation of IPCrypt in Python, supporting all three encryption modes.
4+
description: Reference implementation of IPCrypt in Python, supporting all four encryption modes.
55
permalink: /implementations/python/
66
language: Python
77
repository: https://github.com/jedisct1/draft-denis-ipcrypt/tree/main/implementations/python
@@ -58,7 +58,7 @@ examples:
5858

5959
## IPCrypt Python Implementation
6060

61-
The Python implementation serves as the reference implementation for IPCrypt. It provides all three encryption modes and is designed to be clear, well-documented, and easy to understand.
61+
The Python implementation serves as the reference implementation for IPCrypt. It provides all four encryption modes and is designed to be clear, well-documented, and easy to understand.
6262

6363
## Installation
6464

@@ -83,11 +83,12 @@ cd draft-denis-ipcrypt/implementations/python
8383

8484
## Usage
8585

86-
The Python implementation provides three separate classes for the different encryption modes:
86+
The Python implementation provides separate classes for the different encryption modes:
8787

8888
1. `IPCryptDeterministic` - Deterministic encryption using AES-128
89-
2. `IPCryptNd` - Non-deterministic encryption using KIASU-BC
90-
3. `IPCryptNdx` - Non-deterministic extended encryption using AES-XTS
89+
2. `IPCryptPfx` - Prefix-preserving encryption using dual AES-128
90+
3. `IPCryptNd` - Non-deterministic encryption using KIASU-BC
91+
4. `IPCryptNdx` - Non-deterministic extended encryption using AES-XTS
9192

9293
### Deterministic Encryption
9394

www/pages/about.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IPCrypt resolves these conflicts through purpose-built cryptographic techniques
2929

3030
- **Efficiency and Compactness**: All variants operate on exactly 128 bits, achieving single-block encryption speed
3131
- **High Usage Limits**: Non-deterministic variants safely handle ~4 billion (nd) to ~18 quintillion (ndx) operations per key
32-
- **Format Preservation**: Deterministic mode produces valid IP addresses that flow through existing infrastructure
32+
- **Format Preservation**: Deterministic and prefix-preserving modes produce valid IP addresses that flow through existing infrastructure
3333
- **Interoperability**: Identical results across implementations enable seamless data exchange
3434

3535
### For Privacy Advocates
@@ -99,15 +99,15 @@ Many organizations currently use flawed mechanisms to protect IP addresses:
9999

100100
IPCrypt offers fundamental advantages:
101101

102-
| Feature | Common Approaches | IPCrypt |
103-
| --------------------------- | --------------------------- | ------------------------------------------- |
104-
| Speed | Varies, often slow | Single-block speed for network rates |
105-
| Data Size | Often expands significantly | Compact: 16-32 bytes total |
102+
| Feature | Common Approaches | IPCrypt |
103+
| --------------------------- | --------------------------- | ------------------------------------------ |
104+
| Speed | Varies, often slow | Single-block speed for network rates |
105+
| Data Size | Often expands significantly | Compact: 4-32 bytes total |
106106
| Reversibility | Usually one-way | Fully reversible with key |
107107
| Security Analysis | Often unclear | Mathematically provable properties |
108108
| Interoperability | Usually proprietary | Standardized across implementations |
109109
| Privacy Guarantees | Inconsistent | Configurable: deterministic or randomized |
110-
| Format Preservation | Rarely supported | Available in deterministic mode |
110+
| Format Preservation | Rarely supported | Available in deterministic and pfx modes |
111111

112112
## Real-World Applications
113113

@@ -139,6 +139,7 @@ def log_network_event(client_ip, event_type, timestamp):
139139
```
140140

141141
**Benefits:**
142+
142143
- Logs can still be analyzed for patterns and anomalies
143144
- IP addresses are protected from casual observation
144145
- Compliance with privacy regulations is improved
@@ -179,6 +180,7 @@ def prepare_data_for_sharing(attack_data):
179180
```
180181

181182
**Benefits:**
183+
182184
- Attack patterns can be shared without exposing actual IP addresses
183185
- Each sharing instance uses different tweaks, preventing correlation
184186
- The original organization can still decrypt if needed
@@ -218,6 +220,7 @@ LIMIT 10;
218220
```
219221

220222
**Benefits:**
223+
221224
- IP addresses are not stored in plaintext
222225
- Queries can still be performed efficiently using indexes
223226
- Analytics and grouping operations work as expected
@@ -264,6 +267,7 @@ class PrivacyCompliantAnalytics:
264267
```
265268

266269
**Benefits:**
270+
267271
- Analytics can be collected without storing personal data
268272
- Unique visitor counting still works accurately
269273
- No need to obtain explicit consent for IP storage
@@ -283,4 +287,4 @@ When implementing IPCrypt in real-world applications, consider the following:
283287

284288
Ready to implement IPCrypt in your project? Check out our [developer resources]({{ site.baseurl }}/resources/) and choose from [multiple language implementations]({{ site.baseurl }}/implementations/).
285289

286-
For a detailed understanding of the cryptographic constructions, read the full [specification](https://datatracker.ietf.org/doc/draft-denis-ipcrypt/){:target="_blank" rel="noopener"}.
290+
For a detailed understanding of the cryptographic constructions, read the full [specification](https://datatracker.ietf.org/doc/draft-denis-ipcrypt/){:target="_blank" rel="noopener"}.

www/pages/encryption-modes.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: page
33
title: IPCrypt Encryption Modes
4-
description: Detailed explanations of IPCrypt's encryption modes - deterministic, non-deterministic (nd), and extended non-deterministic (ndx).
4+
description: Detailed explanations of IPCrypt's four encryption modes - deterministic, prefix-preserving (pfx), non-deterministic (nd), and extended non-deterministic (ndx).
55
permalink: /encryption-modes/
66
---
77

@@ -405,7 +405,11 @@ IPCrypt offers the following encryption modes:
405405
<div class="feature-list">
406406
<div class="feature-item">
407407
<div class="feature-icon">🔑</div>
408-
<div class="feature-text"><strong>Key Requirement</strong>: Uses a 32-byte key for enhanced security</div>
408+
<div class="feature-text"><strong>Key Requirement</strong>: Uses a 32-byte key split into two independent 16-byte AES-128 keys (K1 and K2) for the sum-of-permutations PRF construction</div>
409+
</div>
410+
<div class="feature-item">
411+
<div class="feature-icon">⚠️</div>
412+
<div class="feature-text"><strong>Critical Constraint</strong>: The two 16-byte halves of the key MUST NOT be identical. Using identical values for K1 and K2 causes the XOR operation to cancel out, returning the original IP address unchanged.</div>
409413
</div>
410414
<div class="feature-item">
411415
<div class="feature-icon">🔍</div>

www/pages/examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ The following examples demonstrate the four encryption modes of IPCrypt:
191191
<li>Maintains native IP address sizes (4 bytes for IPv4, 16 bytes for IPv6)</li>
192192
<li>Enables network-level analytics while protecting actual network identities</li>
193193
<li>Deterministic - same input always produces same output with same key</li>
194-
<li>Uses 32-byte key for enhanced security</li>
194+
<li>Uses 32-byte key (two independent 16-byte AES-128 keys)</li>
195195
</ul>
196196
</div>
197197
</div>
@@ -337,7 +337,7 @@ def get_data():
337337
"events": [
338338
{
339339
"timestamp": "2025-04-24T10:15:32Z",
340-
"encrypted_ip": "08e0c289bff23b7cb349aadfe3bcef56221c384c7c217b16",
340+
"encrypted_ip": "a73f4e19c0d285b6f1e8d3a7924bc50e61d7f83a4b92c1e5",
341341
"user_agent": "Mozilla/5.0...",
342342
"page": "/products",
343343
"action": "view"

www/pages/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ permalink: /
5151
<div class="feature-card">
5252
<h3 class="text-xl font-bold mb-3">Format Preservation</h3>
5353
<p>
54-
Deterministic mode produces valid IP addresses, enabling encrypted addresses to flow through existing infrastructure without modification.
54+
Deterministic and prefix-preserving modes produce valid IP addresses, enabling encrypted addresses to flow through existing infrastructure without modification.
5555
</p>
5656
</div>
5757
@@ -181,7 +181,7 @@ permalink: /
181181
<h3>ipcrypt-ndx</h3>
182182
<span class="badge badge-orange">Extended non-deterministic</span>
183183
</div>
184-
<p class="example-description">32-byte output, unlimited operations per key</p>
184+
<p class="example-description">32-byte output, ~2<sup>64</sup> operations per key</p>
185185
<div class="example-samples">
186186
<div class="sample">
187187
<span class="input">192.168.1.1</span>

www/pages/playground.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ permalink: /playground/
2323
<div class="mb-4">
2424
<label for="encryption-key" class="block mb-2 font-medium">Encryption Key (hex):</label>
2525
<input type="text" id="encryption-key" class="w-full p-2 border rounded" placeholder="Enter a 16-byte hex key (32 characters)" value="000102030405060708090a0b0c0d0e0f">
26-
<p class="text-sm text-gray-600 mt-1" id="key-help">For deterministic and nd modes: 16 bytes (32 hex chars). For ndx mode: 32 bytes (64 hex chars). Default key provided for demonstration.</p>
26+
<p class="text-sm text-gray-600 mt-1" id="key-help">For deterministic and nd modes: 16 bytes (32 hex chars). For pfx and ndx modes: 32 bytes (64 hex chars). Default key provided for demonstration.</p>
2727
</div>
2828
2929
<div class="mb-4">

www/pages/resources.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,33 @@ To implement IPCrypt:
2525

2626
1. **Choose an encryption mode** based on your requirements:
2727
- `ipcrypt-deterministic`: When you need format preservation or duplicate detection
28+
- `ipcrypt-pfx`: When you need to preserve network structure for analytics
2829
- `ipcrypt-nd`: For general privacy protection with reasonable storage overhead
2930
- `ipcrypt-ndx`: For maximum privacy protection when storage permits
3031
2. **Generate appropriate keys**:
3132
- 16 bytes (128 bits) for deterministic and nd modes
32-
- 32 bytes (256 bits) for ndx mode
33+
- 32 bytes (256 bits) for pfx and ndx modes
3334
3. **For non-deterministic modes**, use uniformly random tweaks
3435
4. **Test against the specification's test vectors** to ensure correctness
3536

3637
## Implementation Information
3738

3839
### Key Management Suggestions
3940

40-
Good key management practices are important when using IPCrypt:
41+
Good key management practices are essential when using IPCrypt:
4142

42-
- **Creating Keys**: Consider using a cryptographically secure random number generator
43-
- **Storing Keys**: Try to store keys securely, such as in a key management system
44-
- **Changing Keys**: Consider rotating keys periodically as a security practice
45-
- **Key Separation**: Use different keys for different applications or data sets
43+
- **Creating Keys**: Keys MUST be generated using a cryptographically secure random number generator (see RFC 4086)
44+
- **Storing Keys**: Store keys securely, such as in a key management system
45+
- **Changing Keys**: Rotate keys periodically as a security practice
46+
- **Key Separation**: Use different keys for different applications or data sets. The specification defines HKDF-based key derivation for deriving mode-specific keys from a single master key
4647

4748
### Helpful Tips
4849

4950
When working with IPCrypt, here are some suggestions that might be helpful:
5051

5152
1. **Check IP Formats**: It's a good idea to make sure IP addresses are properly formatted before encryption
5253
2. **Handle Errors Kindly**: Consider how your code will respond if something unexpected happens
53-
3. **Think About Timing**: For security-sensitive applications, constant-time operations can help prevent timing analysis
54+
3. **Constant-time Operations**: Implementations MUST use constant-time operations to mitigate side-channel attacks
5455
4. **Test Your Code**: You might want to check your implementation against the examples in the specification
5556
5. **Performance Optimization**: All variants are designed for single-block speed critical for network-rate processing
5657

0 commit comments

Comments
 (0)