Skip to content

Fix deterministic encoding with seed parameter#38

Merged
kpdyer merged 1 commit into
masterfrom
fix/deterministic-encoding-issue-37
Jan 22, 2026
Merged

Fix deterministic encoding with seed parameter#38
kpdyer merged 1 commit into
masterfrom
fix/deterministic-encoding-issue-37

Conversation

@kpdyer

@kpdyer kpdyer commented Jan 22, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #37

The seed parameter in DfaEncoder.encode() was documented to provide deterministic output, but the implementation was not actually deterministic.

Fixes #37

The seed parameter was documented to provide deterministic output,
but the implementation was not actually deterministic because:
1. The encryption IV was always random
2. Padding bytes were always random

This fix ensures that when a seed is provided:
1. The encryption IV is derived deterministically from the seed
2. Padding bytes are derived deterministically from the seed

Now the same (plaintext, seed, key) combination will always
produce identical ciphertext.

Also updated the example to verify determinism.
@kpdyer kpdyer merged commit 2c29da6 into master Jan 22, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Deterministic encoding with seed parameter does not produce deterministic output

1 participant