Skip to content

Allow seed to be specified as a string.#1863

Open
webern wants to merge 1 commit intoDataDog:mainfrom
webern:seed-string-support
Open

Allow seed to be specified as a string.#1863
webern wants to merge 1 commit intoDataDog:mainfrom
webern:seed-string-support

Conversation

@webern
Copy link
Copy Markdown

@webern webern commented Apr 27, 2026

What does this PR do?

Add a Seed newtype wrapping [u8; 32] with custom deserialization that accepts either a 32-element byte array (existing behavior) or a plain string. String seeds are hashed with SHA-256 to produce the 32 seed bytes, so "black cat" and "umbrella" each yield a unique but consistent seed without forcing users to supply raw byte arrays.

Motivation

Sorry this is a bit of a drive-by PR. But I noticed we keep copying the same array over and over, basically always using the same seed, because we are too lazy to edit those u8s. A colleague suggested maybe they would open a PR to maybe make it possible to just bloop a string there and have it hashed stably, so I scooped him and opened a PR.

Related issues

It just makes it easier to bloop your stable seed when copying a lading config.

Add a Seed newtype wrapping [u8; 32] with custom deserialization that
accepts either a 32-element byte array (existing behavior) or a plain
string. String seeds are hashed with SHA-256 to produce the 32 seed
bytes, so "black cat" and "umbrella" each yield a unique but consistent
seed without forcing users to supply raw byte arrays.
@webern webern requested a review from a team as a code owner April 27, 2026 16:20
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.

1 participant