hc
2023-11-20 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c
1
2
3
4
5
6
7
8
9
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
 
if [ ! -"$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