ECDSA and ECDH give us the following methods:
// ECDSA var signature = ECDSA.sign(privateKey, hash); var isValid = ECDSA.verify(publicKey, hash, signature); // ECDH var sharedSecret1 = ECDH.compute(node1.publicKey, node2.privateKey); var sharedSecret2 = ECDH.compute(node2.publicKey, node1.privateKey); // sharedSecret1 == sharedSecret2; ECDSA give as a very long signature (73 bytes).
I am wondering why we need ECDSA if we can do signing only with ECDH and get much smaller signature:
function sign(priavteKey, hash) { // generate public key from private key var publicKey = computePublicKey(hash); var sharedSecret = ECDH.compute(publicKey, privateKey); var signature = hash(sharedSecret); return signature; } function verify(publicKey, hash, signature) { var sharedSecret = ECDH.compute(publicKey, hash); return (hash(sharedSecret) == signature); } This method exposes one of the private keys of ECDH and uses it for generating the signature hash. Is there any way that this method can expose the real private key?
I've been reading these answers and it seems ok…
signfunction is supposed to be doing. You treathashas some value at first and then as a function. $\endgroup$