Added error checking to sha.