Partial implementation of HWE.