Improved AAE hash calculation.