https://github.com/torvalds/linux
Raw File
Tip revision: 1291a0d5049dbc06baaaf66a9ff3f53db493b19b authored by Linus Torvalds on 18 December 2017, 02:59:59 UTC
Linux 4.15-rc4
Tip revision: 1291a0d
gen-random-seed.sh
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0

if [ ! -f "$1" ]; then
	SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'`
	echo "const char *randstruct_seed = \"$SEED\";" > "$1"
	HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'`
	echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
fi
back to top