# Questions tagged [hmac]

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

564 questions
Filter by
Sorted by
Tagged with
7 views

### Reverse SHA256 Hashed Value from Multiple Instances where Part of Hashed Value is known

I apologize in advance if this question has been answered already. However, I have not been able to find an existing answer - despite the case being pretty simple and common I imagine. Perhaps there ...
114 views

### Why is birthday attack invalid on this MAC

I am trying to understand why the following birthday attack is invalid for this MAC construction. ...
16 views

### Use HMAC for every block encryption operation [duplicate]

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 ...
65 views

### Can a one time public key'd HMAC be secure?

Imagine authentication like $hmac = H(nonce, ciphertext)$. $nonce$ is truly random and chosen (randomly and WITHOUT replacement) from predetermined set $N$. So ${nonce} \in N$ and once used cannot be ...
35 views

### What is the difference between HMAC-SHA3-512 and KMAC? [duplicate]

Reading through the wikipedia entry for HMAC I see that SHA-3 can be used with the HMAC algorithm to give HMAC-SHA3-512. I also know that there is KMAC, which from ...
36 views

### How to produce Auth Data and tag in GCM? Does MAC appended CTR mode encrypted text weaker than GCM?

In https://en.wikipedia.org/wiki/Galois/Counter_Mode, there's a diagram which tells us how GCM works in general. I have watched computerphile video on how ECB,CBC and CTR mode works and able to ...
87 views

### is there any good attack model of HMAC?

are there any good attack models of HMAC ? like how it can be attacked ? if there are any possible attacks of HMAC i would be happy to know about it.
68 views

### What is the need of xor-ing the key with an outer and inner pad in HMAC?

The diagram above shows the standard HMAC algorithm. However consider the algorithm of HMAC without xoring the key with outer or inner pad. In other words let the structure of HMAC remain the same ...
44 views

### Is the collision chance 2^(n/2) of an n-bit tag τ unchanged if reduced to (n/2)-bits using a reduction of τ to some 2^(n/2) order group element?

If $H(k, Μ) = τ$, in the context where $τ$ is an $n$-bit tag produced as a mac on a key, $k$, and a message, $M$, through a keyed-hash function, $H$, is there a function $F(τ) = T$ that transforms $τ$ ...
305 views

### Does hashing an ECB encryption with a strong hash function produce a secure MAC?

Does applying a strong hash function like SHA-256 to the ECB-encryption of a message (using some secret key $K$) produce a secure mac? For example, given a message $m$, would a simple mac construction ...
55 views

### HMAC key generation and encoding

I've this piece of .NET code that is based on a Microsoft sample on how to generate a key and sign using HMACSH256. But I've altered the key generation a little bit and also decided to use Base64 to ...
65 views

### What authenticated encryption do kerberos use in windows?

I have learned about the kerberos protocol and seen that the windows version uses a couple of authenticated encryption schemas (like rc4-hmac-md5). What type of authenticated encryption is it? Is it a:...
42 views

### Necessity of PBKDF2 in current Setup?

I have a single password which is random bytes that encrypts a database. Right now I am using an encryption scheme of https://gist.github.com/jbtule/4336842. To summarize, we take our one password, ...
65 views

### Can future time-based keys be deduced from a previous key?

If a time-based key generated by an authenticator app like Google Authenticator is compromised, can future keys be deduced from the compromised key?
111 views

### Does SHA384 make sense with HMAC-SHA256?

In the sense of security level (as defined, for example, by Ferguson and Schneier in the book Practical Cryptography), does it make sense to use SHA384 with HMAC-SHA256 in the general settings. By ...
46 views

### Use peppers with Bcrypt (HMAC + Bcrypt)

Is it useful to combine HMAC with Bcrypt ? If it so, should I do the HMAC on the password before "Bcrypt"ing it ? or should I do the HMAC on the Bcrypt output ?
37 views

### Managing master keys used in PBKDF2 and HMAC (store, rotate)

My use case: I have few master keys, I use each for a specific operation (e.g. one for encrypting user's data and another for creating JWT signatures etc...). I use these master keys in two specific ...
20 views

### HMAC vs hashing (data + pepper) [duplicate]

Is there a difference between HMAC and hashing (data + pepper) or both of them are equally secure ?
58 views

### AWS signature v4 key derivation

Generating Authorization header with AWS signature v4 involves deriving signing key as follows: https://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html ...
32 views

### Complexity of deriving message from CMAC vs HMAC when the key is known

From the description of CMAC and HMAC, given the key and the tag, I think it is easy to derive the CMAC message than the HMAC message. After obtaining the key and tag for CMAC, an intruder can apply ...
63 views

### How to compose multiple values to MAC authenticate?

If the data I want to authenticate consists of multiple values and I compute a MAC simply concatenating the values, an adversary can "shift" characters within those values without ...
36 views

### Confused about encapsulation using different types of hash functions

I'm reading Improved Efficiency for CCA-Secure Cryptosystems Built Using Identity-Based Encryption. In Section 4 there is a description of encapsulation schemes that says We suggest an encapsulation ...
42 views

### Is 64-bit SHA-256 IV-based MAC for fixed-length messages reasonably secure?

I want to use truncate8(SHA256-nopad(IV=secret, message)) as a 64-bit MAC, where message is guaranteed to be exactly one hash ...
122 views

### What does the running transcript hash in RFC-8446: TLS 1.3 do?

From RFC8446: In general, implementations can implement the transcript by keeping a running transcript hash value based on the negotiated hash. Note, however, that subsequent post-handshake ...
68 views

### Question about IETF RFC6979 determinisitc (EC)DSA document section 3.6 additional data k'

In RFC6979, on page 14, Section 3.6 "Variants": o. Additional data may be added to the input of HMAC, concatenated after bits2octets(H(m)): ...
88 views

### What's the difference between H(m) $\oplus$ H(key) and H(m || key) in MAC construction?

We all know that HMAC has the form of $H(ikey || H(okey || M))$. I'm wondering what if we replace the H(okey || M) into H(okey) $\oplus$ H(M)? In other words, is H\Big( ikey \mathbin\| \big( H(okey) ...
94 views

### How to calculate a hmac and cmac

I'm searching for a simple description that tells me in a schematic way how hmac and cmac is calculated. So far I found the following: ...
21 views

### Why doesn't appending a message to a key instead of vice versa defeat length extension attack? [duplicate]

It's well established that H(K||M) is vulnerable to length extension attacks for SHA-2 and other hashing algorithms, and instead an HMAC construction should be used. However - why can't H(M||K) be ...
76 views

### Is nonce-less Encrypt-then-HMAC as secure as poly1305

While reading https://crypto.stackexchange.com/a/88732/87450 I noticed that it suggests encrypt-then-HMAC as a defense for partition attacks. However as far as I know unlike poly1305, HMAC does not ...
92 views

### Encrypt-then-HMAC with a single key is secure?

The partition oracle attacks exploits the non-committing AEAD schemes. Informally, a committing encryption scheme is one for which it is computationally intractable to find a pair of keys and a ...
256 views

### Bitcoin Key Recovery Without Nonce Re-Use

There are a lot of questions in these forums regarding the recovery of private keys. But I'm here to postulate on something unique to a specific piece of research that I looked into recently. The ...
384 views

### Generating HMAC(SHA256) keys using WebCrypto deriveKey() API

I am using the javascript WebCrypto API window.crypto.subtle.deriveKey() API to generate HMAC keys like this: ...
21 views

### Is Poly1305 enough for cascading ciphers? [duplicate]

ChaCha20 along with Poly1305 provides confidentiality and integrity. Now suppose I cascade AES on top of ChaCha20. Is it safe to assume that the Poly1305 MAC is still secure, even if I cascade ...
74 views

### How do high hash rates affect hashed password security?

Given the increase in hash rate since the rise of numerous block chains, I wonder how this affects the security of many hashed password systems. Is a standard linux ...
43 views

### Authentication tag length and post-quantum security

The recommended hash length for post-quantum security seems to be either 384-bits or 512-bits. 512-bits gives 256-bit collision resistance, and 256-bit security is obviously ideal for post-quantum ...
26 views

187 views

### How to correctly implement an archetypal encrypt-then-MAC AES-CTR + HMAC mode cipher?

I've created an AES implementation in Python as a learning experience (mainly for encrypting/decrypting files), and wanted to make sure that I haven't made any huge mistakes in my logic (of course, ...
81 views

### HMAC256(K,m) vs HMAC256(K,K)

I have a key size of 128 bits. My message size is fairly short (e.g., 32 bits - and widely known). Although I am doing a SHA256, the result of the HMAC will be truncated to 128 bits. So my question is:...
84 views

### Does the security proof of HMAC somehow change if it's instantiated with sponge-based hash functions with small rate and large capacity?

HMAC was introduced in [1], as a MAC that has its security proof based on the properties on the underlaying hash function. The hash functions considered in that paper were ones based on the Merkle-...