Elliptic and hyperelliptic curve point counting through deformation by