more efficant way of calculating the sha1 sum. closing connections