add client and move some network functions
add check for zero-length array in CalculateHash()