The current implementation is somewhat collision-prone; it uses $* which collapses separate arguments into a space-delimited string, meaning calling a function with a single argument 'a b c' will hash to the same identifier as three separate arguments 'a' 'b' 'c'.
The existing hashing behavior could be made more plug-able as well. Users should be able to specify a particular function/command to use as the hash function (e.g. to tune performance). Something like:
if [[ -n "$BC_HASH_COMMAND" ]]; then
_bc_hash_command="$BC_HASH_COMMAND"
elif command -v sha1sum &> /dev/null; then
_bc_hash_command=sha1sum
elif ...
fi
if [[ -z "_bc_hash_command" ]]; then
error!
fi
The current implementation is somewhat collision-prone; it uses
$*
which collapses separate arguments into a space-delimited string, meaning calling a function with a single argument'a b c'
will hash to the same identifier as three separate arguments'a' 'b' 'c'
.The existing hashing behavior could be made more plug-able as well. Users should be able to specify a particular function/command to use as the hash function (e.g. to tune performance). Something like: