# Tagged Questions

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

58 views

### Strength of $H(k\|H(m))$ as a MAC algorithm

What is the strength of $H(k \| H(m))$ compared to HMAC? Compared to $H(m \| k)$? What is the strength in bits of a given key/output size?
55 views

### Do you need a HMAC if decryption attempts are severely limited?

I am considering an application where data bandwidth is extremely limited, and considering removing message authentication codes from encrypted transmissions. The encryption method is currently ...
91 views

### Key size for HMAC-SHA256 [duplicate]

After reading a bunch of past stack exchange posts like this one and RFCs 5869, 2104, and 4868 I felt comfortable that a 32-byte key was sufficient for HMAC-SHA256. However, I am implementing my code ...
43 views

### Parallel file encryption and authentication for large files

For a cloud storage upload client I want to encrypt files during upload, so that they cannot be read by the cloud service provider or anyone who gains access to the account. I would like to use some ...
64 views

### Deriving AES key and HMAC key from shorter master key

I am working in .NET and as far as I can tell the only choice for key derivation is PBKDF2-HMAC-SHA1. SHA1's output size is only 160 bits. But I am implementing authenticated encryption and thus ...
55 views

### What is the security strength of an n-bit HMAC?

HMACs depend on preimage resistance, or so I have read. The security strength of hash function with an $n$-bit output against collision attacks is $2^{\frac{n}{2}}$. Against preimage attacks, it is ...
29 views

### Length extension attacks or prefix attacks on HMAC

Why HMACs are not vulnerable to length extension attacks or prefix attacks? (As commented by @codesinchaos, That's a different construction. So it's related, but no duplicate of Why is ...
108 views

### Encrypt-then-HMAC implementation - am I doing it right?

I want to implement authenticated encryption using C#. There is a dot net class called encryptAndAuthenticate, but it is only supported on windows 8 or later, and I need the code to also work on ...
104 views

I'm studying mechanisms of integrity and authentication in symmetric encryption scenarios. I want to propose some examples to see whether I got the point here: Let $m$ be the message, $c$ the ...
224 views

### HMAC Secure Key Exchange?

Within RFC 2104 section 3 there is discussion around keys (below). How are these keys agreed upon/distributed? Practically speaking is asymmetric crypto a requirement to "bootstrap" and distribute ...
34 views

### Is this session start protocol secure?

I am working on a password manager application that saves the user's passwords in a remote server. I need to use AES in CTR mode to encrypt the passwords before sending them to the server. The client ...
38 views

### The solution of insert MAC in a ciphertext without Authenticated Encryption supported

From Should we MAC-then-encrypt or encrypt-then-MAC?, I understand I should do Encrypt-than-MAC, which the MAC included all the information such as IV and cipher text. After reading Why choose an ...
38 views

### Proper authenticated encryption

I am using AES-CBC, authenticating using HMAC-SHA512 and I was wondering whether my thought process and implementation are correct. The message send over the network is: ...
45 views

### Is it possible to brute force a single smaller variable in $\operatorname{HMAC-SHA512}(k, a\ ||\ b\ ||\ c\ ||\ d)$?

Given $c' = \operatorname{HMACSHA512}(k, a\ ||\ b\ ||\ c\ ||\ d)$ and the 32-bit integers $a$, $b$, $c$, and $d$ is it feasible to alter $b$ and produce a valid MAC under the unknown key? I ...
190 views

### Client Puzzles and HMAC

I'm learning about client puzzles for DoS (Denial of Services) Protection, and I came across this question. For each request, the server sends the client a freshly generated random challenge r and ...
89 views

### HMAC-SHA1 vs. AES

This might be a very silly question, but I am a total novice in encryption. I don't know where to start searching for an answer to this problem. I am building applications using a proprietary ...
157 views

### Is there any benefit to verifying PKCS#7 padding when using AES CBC and HMAC?

As I'm using HMAC to ensure integrity and authenticity of the ciphertext, is there any additional security benefit to verifying PKCS#7 padding when decrypting using AES CBC? A previous question asked ...
35 views

### Is it safe to use a key as message in keyed hashing (HMAC)?

Scenario: User gives password. A "password key" is derived from the password (e.g. by PBKDF2). A random salt is applied. The password key is hashed with a HMAC algorithm (e.g. HMAC-SHA256), with ...
50 views

### Key derivation using the main AES encryption key and some plain text

I am using AES 128 bit encryption in java. I have an encryption key and 10 digit plain text. I want to derive a key for HMAC using the AES encryption key and the 10 digit plain text. This plain text ...
58 views

### Understanding WPA2 authentication in details

As far as I know, WPA2 authentication consists of a 4-way handshake. The first message is from the AP, containing the ANounce, a random number generated by the AP, The second message is from the ...
101 views

### Implementing hmac+bcrypt in bash script

I was recently reading Mozilla's Secure Coding guidelines and found their password storage method interesting. They combine an hmac hash of the password with bcrypt which allows for added security ...
41 views

### How to make a “zero knowledge” cache/key-value store

I'd like to use a possibly insecure cache for storing expensive-to-calculate sensitive information. My requirements are: If the cache ever gets compromised it should reveal nothing about its ids or ...
47 views

### Difference between HMAC-SHA1(key, msg) vs SHA1(key + msg) [duplicate]

Is there any practical difference from using HMAC-SHA1(key, msg) vs SHA1(key + msg) as a way to verify the ...
130 views

### PHP AES 256 CBC faster than AES 128 CBC? Or am I doing something wrong?

for last couple of days I'm learning a bit about encrypting data in PHP, as I need a good encryption/decryption function for storing user's passwords in DB. I use ...
77 views

### Question about HMAC with SHA1

I would like to make sure I understood HMAC. Wikipedia declares it like: $$\operatorname{HMAC}(K,m)=H((K\oplus\text{opad})||H((K\oplus\text{ipad})||m))$$ If I want to use HMAC-SHA1, am I correct to ...
834 views

### Is there a null HMAC?

I came up with this question while unit testing a function that includes an HMAC. What is the expected behavior of an HMAC with a well-defined key and a set of data with no elements in it? Is there ...
59 views

### Deriving a key for HMAC, using PBKDF2

What is the recommended way to derive a key for an HMAC-SHA256, from a passphrase and salt? I'd like to compute an HMAC-SHA256. I have a passphrase, and a message. I note that RFC-7518 (JWA) ...
55 views

### NIST HMAC Test vectors

I am searching test vectors of the HMAC-SHA256 primitive to verify the correctness of an implementation. Without hesitation I go on the NIST website to see what they offer. While reading the ...
107 views

### Side channel security of HMAC in software

Assume we have a processor with a symmetric co-processor that supports AES. This processor does however not provide co-processor support for hash algorithms such as SHA-1 or SHA-256. I've got the ...
67 views

For a personal project, I'm building a password manager, based off the project in this syllabus from Stanford http://crypto.stanford.edu/~dabo/cs255/hw_and_proj/proj1.pdf Since I don't exactly have ...
249 views

### Difference between AES CMAC and AES HMAC?

Can someone elaborate on how 'signing' is done using AES- CMAC and AES-HMAC? HMAC Signing as I understand: Compute the HMAC( Hash the key and the input concatenated in a special way) Verification: ...
927 views

### Could an HMAC be used as a hash?

MD5 is considered broken and SHA-1 is closely following, but HMACs built around either are still considered relatively secure. It makes me wonder if MD5 and SHA-1 HMACs can be used as secure hashes. ...
62 views

### Is the security of an HMAC equally important as the security of the cipher itself?

I'm a little unclear on how hash based MAC works... So I would like to know, is the security of your hash function as important as the security of the overall cipher? Basically, if you can crack the ...
40 views

### Keys and key-stretching when authenticating requests?

I'm making a REST application and still a bit confused about this issue. basically, to authenticate incoming requests, I give out userId, issued timestamp, expiry timestamp (normally 3 months after ...
62 views

### Why does NaCl's crypto_auth have twice the security level of crypto_onetimeauth?

The crypto_auth function produces a 256-bit HMAC, with a 512-bit version also available. But the crypto_onetimeauth function ...
93 views

### Would it be better to use HKDF or SCrypt for deriving a child key?

Okay so I'm trying to derive a child public key from an EC public key. I've come up with a couple ideas and now I'd like to know which is more secure. Mp: The master key pair, this includes a ...
239 views

### What size should the HMAC key be with SHA-256?

I'm trying to generate a secret key to be used for HMAC SHA-256 signature processing. I've seen many sample of keys with variable length from 32 characters to 96 characters. What is the ironclad rule ...
60 views

### PBEWithMD5AndDES Cipher does not check for integrity first?

I am running FindBugs with findsecbugs plugin to scan java code for security issues. I am getting "Cipher With No Integrity" error for a Cipher function implemented with "PBEWithMD5AndDES". The legend ...
64 views

### Compromise between HMAC and Digital Signature, by encrypting and sending secret key?

For achieving stateless authentication tokens (like JWT), is there a compromise between the performance of HMAC, and public key distribution of Digital Signature? Scenario: Sender is a centralized ...
104 views

### Is it okay to use an HMAC of the plaintext and a (possibly distinct) key as the IV for symmetric cryptography?

I was thinking of how to create an IV for a block cipher that doesn't require stored state, and I came up with the idea of using an HMAC of the (padded) plaintext and a (possibly distinct) key as the ...
33 views

### Execution time for HMAC-MD5 on a 160 bit data using 128 bit key on a 3GHz CPU [closed]

I need to know the execution time for HMAC -MD5 for a 160 bit data using 128 bit key on a 3 Ghz CPU, kindly specify other parameters of the machine like RAM, operating system used etc
101 views

### Using HMAC as a nonce with AES-CTR encrypt-and-MAC

Suppose I use the following encrypt-and-MAC construction: $E(k_1, k_2, n, m) = E_\text{AES256-CTR}(k_1, n, m) \| \text{HMAC-SHA256}(k_2, m)$, where: $k_1$ and $k_2$ are 256-bit keys $n$ ...
37 views

### Should I authenticate memory data which was loaded from authenticated disk file?

Encrypted fields are loaded from disk file to process memory only after file's HMAC validation is successful. Data is still encrypted in memory and will be decrypted later, on demand, when it needs to ...
558 views

### HMAC vs ECDSA for JWT

I will be implementing JSON web tokens into my website and have a question about implementing them. I have a choice of using two algorithms, HMAC-SHA256 and ECDSA-SHA256. I have used HMAC-SHA256 in ...
111 views

### Is it an overkill to add external integrity check to the AES-GCM encoding?

There is a java library for android which implements integrity checking to predefined encrypting mode(which can be found here). Short class description from author page to avoid further questions ...
63 views

### If a PRG is constructed by iterating a PRF, is it backtracking-resistant?

Say we construct a pseudo-random number generator from a pseudo-random function $f$ (using some constant key $k$ and some initial value $v_0$). We do this by feeding the output block of the PRF back ...
45 views

### Is it possible to have self-authenticated message?

Consider a text with $n$ words which $m$ words of it can be replaced with an equivalent word. Therefore we have $2^m$ different texts with the same meaning. For example "You are {so/very} ...
69 views

### Is a nonce considered 'secret' enough for HMAC?

We're implementing a mobile application which communicates with a web service, and on first install the user sends its deviceid to the web service (over TLS, unauthenticated at this point) - which ...