libk  build-id.sh at [9dd8bab2ac]

File global/build-id.sh artifact a95857b352 part of check-in 9dd8bab2ac


#!/usr/bin/env sh
. global/common.sh

origin=1566169297
now=$(date +%s)
delta=$(expr $now - $origin)


if test "$id_mode" = "private"; then
	# for privacy's sake, we're not to show
	# the hostname. instead, we calculate a
	# hash based on the  time delta and the
	# output of uname -a for extra entropy
	if has "$HASH"; then
		hash="$HASH"
	elif has sha1; then
		hash=sha1
	elif has sha1sum; then
		hash=sha1sum
	else
		say "cannot find a hashing function; privacy mode cannot be used"
		exit 1
	fi

	h=$(printf "%x%s" "$delta" "$(uname -a)" | $hash)
	echo ${h:1:7}
else
	printf "%x:%s" $delta $(uname -n)
fi