Port changes from newcurve and use typed arrays for Curve25519.