I'm searching for the fastest way to verify that a message was sent by the correct user.
- The first solution I know of is to use HMAC. But in order to verify, I'll have to produce another signature and compare it with the original. In my case, this does not seem to be the best choice, because the time needed to verify is practically equal to the time needed to produce the signature.
- To use a classic cryptographic signature (RSA or AES) over a MD hash. I didn't find benchmarks/times for verifying a signature (but just for producing the signature). Surely, to produce a signature is slow, but to verify?
- Finally, is there any algorithm that use a statistical method for granting authentication (most of the messages are valid)?
After comparing benchmarks, it seems there is a third way which is a lot faster (10 times more): to use the GMAC/VMAC algorithms.
I'm developing in Java, but a C/C++ library would also be OK.
Specifically, my questions are:
- Can you confirm that the best solution is GMAC/VMAC for this scope?
- If yes, does anyone have an example for how to write the code for generating/verifying a byte array in Java (perhaps with the Bouncy Castle library).