Towards Efficient Hardware Implementation of Elliptic and Hyperelliptic Curve Cryptography