Avoid potential OOME when calculating SHA-1