Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 12

a method for constructing a message authentication code based on a cryptographic hash function.

3 votes
Accepted

How secure is HMAC

HMAC is a keyed message authentication code construction. … depends on the specific hash function that you're using within HMAC. …
Xander's user avatar
  • 36k
4 votes
Accepted

Does encrypting the message protect it against length extension attacks

Use HMAC, not an arbitrary hash function. This will actually protect you against length extension attacks. Second, you propose to encrypt your pseudo-MAC along with the message. … So, you can either encrypt-then-MAC with HMAC, or better yet, just use an authenticated encryption mode that handles the implementation for you, like AES-GCM, and you don't have to worry about whether …
Xander's user avatar
  • 36k
2 votes
Accepted

Does using a MAC for encryption remove the need for PKCS7 padding with this class?

Additionally, the HMAC key appears to be strongly related to the encryption key. This is not ideal. The HMAC key and encryption key should not be related. … Third, the HMAC calculation needs to be done in constant time to prevent timing attacks. Techniques for doing this in PHP are covered in a comment on hash_hmac. …
Xander's user avatar
  • 36k
26 votes

Timing attack against HMAC in authenticated encryption?

An attacker can create a valid HMAC for a chosen message without knowing the HMAC key. … This is why HMAC comparison needs to be constant-time, comparing all the bytes of the submitted HMAC to the calculated HMAC before returning a response. …
Xander's user avatar
  • 36k
3 votes

Does using the same secret key for AES-256-CBC and HMAC-SHA512 in Encrypt-then-MAC potential...

With HMAC vs AES, no such interference is known. … The general feeling of cryptographers is that AES and SHA-1 (or SHA-256) are "sufficiently different" that there should be no practical issue with using the same key for AES and HMAC/SHA-1. …
Xander's user avatar
  • 36k
1 vote

Detect if AES and hmac keys are invalid

If the HMAC keys are different between the server and the client, the authentication should fail (the server won't be able to create the same MAC from the ciphertext and the server key, since the server …
Xander's user avatar
  • 36k