ECDH updated and randnum bug fixed