gen-random-seed.sh 305 B

12345678910
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. if [ ! -f "$1" ]; then
  4. SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'`
  5. echo "const char *randstruct_seed = \"$SEED\";" > "$1"
  6. HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'`
  7. echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
  8. fi