Is it possible to use HMAC while performing encryption of blocks?
I think that the main problem with the approach would be to get the same output size as the block, from the HMAC function.
Also, the hash function is one-way, so how would one perform the decryption?
Are there any real-world examples for this approach, or is it not feasible?

  • $\begingroup$ @kelalaka Thanks for your comment. Also, isn't there a problem with the fact that the hash function is one way? $\endgroup$
    – Ronnie1023
    Nov 4, 2021 at 12:17
  • $\begingroup$ I replace every encryption operation on a block, with HMAC function. But since the hash function is one-way, when I perform the decryption on every block, there is no inverse function, or am I wrong? $\endgroup$
    – Ronnie1023
    Nov 4, 2021 at 12:23
  • $\begingroup$ Yes, that was my question. Can I encrypt every block with hash function? Is it not possible because of what I said about the one-way property of the hashing function? $\endgroup$
    – Ronnie1023
    Nov 4, 2021 at 12:26
  • $\begingroup$ Does these answer your question? Can I say "I have encrypted something" if I hash something? and Difference between encrypting something and hashing something $\endgroup$
    – kelalaka
    Nov 4, 2021 at 12:29
  • $\begingroup$ FYI, CTR mode is designed for PRF and we can use Hash functions to generate a keystream and encrypt like OTP manner. $\endgroup$
    – kelalaka
    Nov 5, 2021 at 20:18


Browse other questions tagged or ask your own question.