summaryrefslogtreecommitdiffstats
path: root/scripts/gen-randstruct-seed.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gen-randstruct-seed.sh')
-rwxr-xr-xscripts/gen-randstruct-seed.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/gen-randstruct-seed.sh b/scripts/gen-randstruct-seed.sh
new file mode 100755
index 000000000000..61017b36c464
--- /dev/null
+++ b/scripts/gen-randstruct-seed.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+SEED=$(od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n')
+echo "$SEED" > "$1"
+HASH=$(echo -n "$SEED" | sha256sum | cut -d" " -f1)
+echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"