Optimize sdb_hash() and move atoi/itoa into util.c