Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hmac]

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

0
votes
2answers
31 views

Quick scan which data (hmac/fernet) can be decrypted with a key?

I am designing a secure vault, which stores tens of thousands of encrypted messages and authenticated with Fernet/HMAC, A user query the vault with a key, could I use some kind of index to tell if the ...
0
votes
1answer
25 views

Is OpenSSL HMAC vulnerable to length extesion attacks when using MD5 as hash algorithm?

Given that a valid hash for a specific payload is known, would some C code like this be vulnerable to a length extension attack? ...
0
votes
0answers
67 views

Can I Achieve Deterministic Encryption Using AES-GCM with Nonce = HMAC [ message ]

I would like to implement a deterministic encryption scheme within .NET. From the following post it is established using AES-SIV mode is appropriate. As AES-SIV mode is not implemented within the ...
2
votes
1answer
103 views

Is this protocol for masking DB ids sound?

Problem Statement I don't want to expose my internal database ids (or other internal private ids) so to make it harder to abuse them, by e.g. guessing the next id of a sequence or similar. It is not ...
1
vote
1answer
42 views

Security of 64-bit truncated HMAC of Matrix protocol

I have seen other questions like this one, but I am asking this specifically in the context of Riot messaging and the underlying Matrix protocol. A basic summary of their message encryption (using ...
0
votes
0answers
21 views

Mixed HMAC / GMAC with fixed IV [duplicate]

I was just thinking about improving the performance of HMAC - what would be the issues in doing the following: Let $G_K(IV,M)$ be GMAC with a key $K$, for IV and message $M$. Let $H$ be a secure hash ...
0
votes
2answers
80 views

How does AWS Secret key and access key work

Those keys are too short to be public/private RSA keys. What are they? How does it use them to authenticate the client? My guess is: AWS access key ID is a form of unique user/account identifier AWS ...
1
vote
1answer
63 views

AES-GCM cipher tag and IV size, while attempting to render encrypted ciphertext useless by removing them

I'm using AES in GCM mode of operation for encryption/decryption & authentication of segments of data in a file. The layout of each segment can be summerized by this diagram. Each segment is ...
4
votes
2answers
171 views

Would a HMAC digest make sense in an RSA / ECDSA signature?

When MD5 and SHA1 were broken there was, each time, a scramble to upgrade software and certificates to remove the offending algorithm. However, in each case, the HMAC variant of each hash function was ...
2
votes
1answer
56 views

HMAC computation using AES key

I want to compute an HMAC value of a data set using CKM_SHA256_HMAC mechanism with AES key. I have the error code CKR_KEY_TYPE_INCONSISTENT because it seems that I need to use a key of key_type ...
1
vote
1answer
89 views

Hash for use in embedded HMAC application

I developed a GNSS logger (http://flysight.ca) which has become popular for scoring skydiving competitions. At the moment, there is little protection against competitors falsifying tracks, but I would ...
2
votes
1answer
67 views

Authenticated encryption and file data integrity

I've got a task to provide the integrity and an authenticated encryption for files in our application. I need an assurance if my way of thinking is correct. I can't use AES GCM, I have to stay with ...
0
votes
0answers
45 views

Is reverse engineering SHA256-HMAC function possible? [duplicate]

Assume HMAC function is used to generate a 6-digt integers time-based onetime password. As follows: $$K_h =\operatorname{HMAC}(k,t) = H((k\oplus\text{opad})\mathbin\| H((k\oplus\text{ipad})\mathbin\|...
3
votes
0answers
44 views

Orignal Krawczyk's HKDF vs latest NIST SP800-56C

I've noticed that the original HKDF in rfc5869 defines a feedback loop. So the pseudo-code is something like: ...
3
votes
1answer
163 views

Worth taking performance hit of HMAC to gain additional security?

It seems like SHA-512 truncated to 256 bits is usable as a MAC [1]. The advantage is that it's ~50% faster than HMAC-SHA-256 on 64-bit CPUs and ~50% faster than HMAC-SHA-512 on short inputs. (My use ...
-3
votes
1answer
72 views

Which is more secure? $\operatorname{AES-ECB}(key,\operatorname{SHA1}(data+key))$ vs $\operatorname{HMAC-SHA1}(key, data)$ [closed]

$\operatorname{AES-ECB}(key,\operatorname{SHA1}(data+key))$ vs $\operatorname{HMAC-SHA1}(key, data)$ Which is more secure? Which is faster? There is a similar comparison here; HMAC-SHA1(key, data) ...
4
votes
2answers
255 views

GMAC vs HMAC in message forgery and bandwidth

Saarinen in his work GCM, GHASH and Weak Keys says that; The GHASH algorithm belongs to a widely studied class of Wegman-Carter polynomial universal hashes. The security bounds known (this and ...
1
vote
0answers
29 views

Is there an instance where integrity protecting metadata is bad?

In JWEs there's a unprotected data field as well as recipients are not integrity protected. Is there a case where integrity protecting this data would be a problem? If it doesn't make a difference, ...
0
votes
1answer
117 views

Finding the Input if Hash Value, Hash Function, and Key are known

Let's assume that we have a hash value $h$ is calculated by using HMAC-SHA256. We have the key $k$. We also know some information about the input: It contains a pattern like 15 numbers where first ...
1
vote
1answer
216 views

How does the user get the private/public key with HMAC based request signing?

I need to implement a HMAC signing of requests and I have read this article which explains the basics of what it is and how to achieve on theory. https://blog.andrewhoang.me/how-api-request-signing-...
1
vote
1answer
111 views

What are the different use cases between an HMAC and digital signature? [duplicate]

I understand that both an HMAC and digital signature are used to check the integrity and authenticity of a message. Further, I understand that a digital signature is non-repudiatible. What I do not ...
4
votes
1answer
355 views

Do I understand HMAC-SHA-xxx and HMAC-SHA-xxx-yyy correctly?

I've recently started looking at HMAC, and there a few things that I'm not 100% sure that I'm understanding correctly. Am I right about these three things? HMAC-SHA-xxx has an output length of xxx ...
1
vote
0answers
101 views

What lightweight cryptographic hash function for short input could I use for HMAC?

I am looking for a cryptographic hash function that I can configure for HMAC. The input that I will hash is around 50 bytes. The function must be fast, and computationally lightweight.
0
votes
1answer
30 views

Correlate HMAC key and MAC without message

If I have a HMAC_SHA1 MAC and a potential key, can I check whether this key could have produced this signature without knowing any of the message body plaintext?
0
votes
3answers
149 views

AES-GCM not using two keys

It is recommended to use different keys for different purposes, such as encryption and integrity protection. As I see it, AES-GCM only requires one key as input. Two different keys are then generated ...
7
votes
1answer
247 views

HMAC-SHA-512 with a 256-bit key

I am implementing hmac-sha-512 in an integrated system. However, one subsystem is only supports the use of 256-bit keys. I read in https://tools.ietf.org/html/rfc4868 that: However, note that [...
4
votes
3answers
303 views

Encrypt-then-MAC with base64

I've a doubt about the Encrypt-then-MAC approach when using HMAC-SHA256 with AES128 in CBC mode, as seen in https://en.wikipedia.org/wiki/Authenticated_encryption. I need to encode the resulting ...
2
votes
1answer
373 views

HMAC-SHA512 output randomness?

This is regarding an online roulette game that claims to be fair. Here is the explanation: Two strings are created: ...
1
vote
1answer
47 views

Cryptographically secure hash function vulnerable to length extension attacks both to front and to back?

Is there any hash function where both $\text{hash}(m\|k)$ and $\text{hash}(k\|m)$ are vulnerable to length extension, but $\text{hash}(m)$ is itself secure?
4
votes
2answers
183 views

Could a 6502 CPU safely compute a SHA-1 hash in a reasonable length of time?

The 6502 is the CPU in a Tamagotchi (which can be hacked to run custom code). SHA-1 is the default hash used for TOTP (the algorithm used by two-factor authentication tokens and apps). Hopefully you ...
1
vote
2answers
57 views

How to provide partial confidentiality and full integrity for a protocol message?

I want to provide confidentiality and integrity for a protocol. I don't want to encrypt the entire protocol message. I do not want to encrypt the header and timestamp of the protocol message, but I ...
3
votes
3answers
1k views

When do I need to use CBC and HMAC?

As I know CBC does not provide integrity for the message, thus HMAC is used to provide integrity for CBC message. Also, I hear about CBC-MAC which can provide integrity and confidentiality. Which one ...
7
votes
2answers
217 views

Security difference between $\mathrm{Keccak}(k\mathbin\|x)$ and $\mathrm{Keccak}(x\mathbin\|k)$

$\require{begingroup}\begingroup \DeclareMathOperator{\keccak}{\mathrm{Keccak}} \DeclareMathOperator{\concat}{\|} $According to Keccak's website, $\keccak(k \concat x)$ is safe: Unlike SHA-1 and ...
1
vote
0answers
365 views

Is it still safe to use sha1 as an hmac hash function in 2018 [duplicate]

I'm curious if it's safe to use sha1 for an HMAC in 2018 in a platform product. A popular vendor (Twilio) uses an HMAC with sha1 with a shared secret to validate that messages they send are indeed ...
0
votes
2answers
273 views

Is an AEAD the recommended method to add encryption + HMAC to a protocol?

Assuming you are dealing with a competent developer/team, and you are advising on adding security to their protocol. Also for the time being lets not worry about the key establishment and validating ...
1
vote
1answer
129 views

Authentication scheme using HMAC

I have an authentication service, a client and an application service. The client needs to use the application, but they have to be authenticated first. I'm trying to create a simple scheme to do ...
0
votes
1answer
85 views

Challenging Question for the Build a Secure MAC with Special Properties

We would like to ask you to give a construction for requested scheme which provides those properties or give a proof that is not achievable. [Note that unsuccessful attempts to build such a scheme ...
2
votes
3answers
146 views

Two salts, One password

If I have two different MD5 password hashes with two different salts (the salts are known), is there any way to cryptographically deduce if the two passwords match? Other than brute force password ...
2
votes
1answer
292 views

What is the reason of using Pedersen Commitment scheme over HMAC?

I want to implement non-interactive Bit Commitment scheme for messages of arbitrary length. And I am curious, what is the reason of using Pedersen Commitment scheme over Salted Hash (in other words ...
1
vote
1answer
2k views

HMAC Key Sizes for MD5, SHA1, SHA224|256|384|512

I'm trying to find an authoritative source for the HMAC Key sizes for each of the hashing algorithms below. Specifically for TLS implementations of HMAC. I found this table in RFC5246: ...
1
vote
2answers
309 views

HMAC does it matter if I chose the cipher text or the plain text as the message? [duplicate]

I am using HMAC to create a message authentication code. My question is, does it matter if I use cipher text + encryption key or ...
3
votes
0answers
50 views

Is this a more effective HMAC? [duplicate]

I was given an argument in a conversation today and I don't know how to respond to it: H( k || m || k ) should be a better choice of MAC than the traditional HMAC. The person's rationale was that: "...
2
votes
1answer
51 views

Signing different types of messages with the same asymmetric key

I want to be able to sign different types of messages with the same asymmetric key. (For completeness, I am using Ed25519 for my signatures). Why do I want to do this? The same key is used to sign ...
1
vote
1answer
347 views

HMAC SHA256 for deriving session keys using random nonce

I need to derive session key in order to create an application layer secure channel between mobile app and a bluetooth device. My scheme is similar to this scheme that uses a HMAC and counter. ...
2
votes
1answer
254 views

Is transporting a salt, IV, ciphertext and HMAC in an encrypted token an acceptable practice?

I’m porting over some crypto code from Mcrypt (deprecated) to OpenSSL. I’m following a process that a former employee implemented, which is as follows: Create a random salt for use in a PBKDF2 key ...
9
votes
2answers
2k views

How many trials does it take to break HMAC-MD5?

I know that you can find collision in MD5 with 2^64 trials using Birthday paradox. Now everyone is saying that HMAC-MD5 is significantly more secure. How can I ...
1
vote
2answers
206 views

What is a size of mac_length and mac_key_length for TLS cipher suites HMAC using SHA384 and SHA512?

i failed to find explicit definition of hash output size and mac_key_size for hmac based on SHA384 and SHA512. RFC5246 specifies: but defines only
2
votes
0answers
155 views

How to implement security - authenticity/confidentiality/integrity for 6/14 bits radio messages?

I just took over two radio systems (using 433Mhz) - one communicates with 6 bit messages, one with 14 bit messages. Both have a lots of transmitters and one receiver (and, yes bits not bytes). For ...
-1
votes
2answers
130 views

Is HMAC a suitable substitute for HKDF?

My PHP version does not include the hash_hkdf() function, and upgrading versions is not worth the trouble for my project (which is for personal pleasure, not for ...
0
votes
1answer
129 views

6 Byte for HMAC in wireless system secure?

A wireless system has 8 byte payload and 6 byte for message authentication. Scheme: ...