# RSA/DSA: Wouldn't it make sense to sign using decoding the data hash?

Why is encoding using the private key used for signing? Wouldn't it make sense to keep the premise, that private is for decoding and public is for encoding? i.e. create a hash and threat it as a result of the crypting and decrypt it. The decrypted value being the "signature". Than when someone want to validate the signature, he would encrypt the signature and he would get the hash.

Am I missing something? Why is this not used?

-
Sorry, it is not really clear what you mean. What you describe is (with some complications left away) how an RSA signature works. What actually is your question? –  Paŭlo Ebermann May 28 '12 at 18:42
It is? Great :) I assumed it works somehow differently = that it uses different way to "encode" then m^d (mod n)... –  Tomáš Fejfar May 28 '12 at 18:55
These are the "complications left away". To do it securely you'll have to use some kind of padding, and the padding schemes used for signing are something else than the padding schemes used for encryption (and obviously it is not the decryption unpadding). But the actual keyed operation is the same for signing, validating, encrypting and decrypting. –  Paŭlo Ebermann May 28 '12 at 19:00

Thanks for your answer. You are correct - that it's mostly that I don't like terminology. Note that the private exponent is called d (as in decrypting) in most resources and the public is called e (as in encrypting). That puzzled me. –  Tomáš Fejfar May 28 '12 at 19:00
@TomášFejfar: I believe that the common $d$ and $e$ convention dates back to the early days of RSA (probably the original SciAm article). While it's too historically entrenched to modify, you shouldn't think that it indicates what modern thinking of RSA is. –  poncho May 28 '12 at 19:08