HMAC SHA-1 stands for Hashed Message Authentication Code using Sercure Hash Algorithm 1. It applies a hash algorithm to data and uses a private key or secret key to provide sender authentication.
Questions tagged [hmacsha1]
302 questions
38
votes
11 answers
CommonHMAC in Swift
I'm trying to create a HMAC SHA-1 hash of a string in Swift but can't figure out how to interact with the APIs as it doesn't seem to be importing the CommonCrypto framework. I've tried various different forms of "import CommonCrypto" and creating a…

Matt Donnelly
- 417
- 1
- 4
- 6
28
votes
2 answers
Is there any function for creating Hmac256 string in android?
Is there any function for creating Hmac256 string in android ?
I am using php as my back end for my android application, in php we can create hmac256 string using the php function hash_hmac () [ ref ] is there any function like this in Android…

Bikesh M
- 8,163
- 6
- 40
- 52
14
votes
4 answers
How to resolve 'no matching mac found error' when I try to ssh
The following is the error I am getting:
no matching mac found: client hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 server…

Daniel vijay Sundar
- 185
- 1
- 2
- 8
14
votes
2 answers
RFC4226 HOTP Java Implementation
I tried to copy the HOTPAlgorithm.java codes (HOTPAlgorithm.java) and compared it against the official HOTP RFC 4226's sample implementation (RFC4226 Page 27) found on Page 27 of the official RFC4226 document. Both the HOTPAlgorithm.java and the…

gsunnic
- 321
- 4
- 9
10
votes
2 answers
HMAC-SHA1 in Rust
I'm trying to apply HMAC-SHA1 in order to check some content but I'm unable to make it work.
These are the tests I have:
#[cfg(test)]
mod tests {
use crypto::hmac::Hmac;
use crypto::mac::Mac;
use crypto::sha1::Sha1;
use…

robertohuertasm
- 846
- 9
- 17
9
votes
3 answers
Trying to digitally sign via HMAC-SHA1 with PHP
I'm trying to setup some Google Maps Premier API action, and to do so, I need to sign my URLs to authenticate. If you go down to Signature examples, there is some Python, C# and Java code to show you how to do the signature via HMAC-SHA1. There is…

Conradaroma
- 151
- 1
- 2
- 6
8
votes
3 answers
Is a hmac-sha1 hash always 20 bytes long? Python code
Is the digest always 20 bytes long? len(hashed.digest()) seems to always be 20.
hashed = hmac.new(key, signature_base_string, sha)
print hashed.digest()
print len(hashed.digest())
i = 0
for c in hashed.digest():
i = i + 1
print…
user667674
8
votes
1 answer
Validating GitHub Webhook HMAC signature in Go
I've written the following function for validating the X-Hub-Signature request header returned by the GitHub API as part of the webhook's payload.
func isValidSignature(r *http.Request, key string) bool {
// Assuming a non-empty header
…

Kshitij Saraogi
- 6,821
- 8
- 41
- 71
7
votes
2 answers
Google OTP Generation Java
I am currently trying to recreate a Google One Time Password generator. I use a shared secret generated when I setup Google Authenticator.
I tried looking into the Google Authenticator sources and all around the internet really and I find a lot of…

Guillaume Wilmot
- 143
- 1
- 10
7
votes
1 answer
Go Hmac SHA1 generates hash different from Hmac SHA1 in Java
I'm just starting to learn Go and I'm trying to rewrite my existing small application from Java to Go.
I need to create Base64 hash of input string with key using Hmac SHA1 algorithm.
My Java code:
private String getSignedBody(String input, String…

Artem Nikitin
- 835
- 1
- 8
- 10
6
votes
1 answer
Crypto++ pbkdf2 output is different than Rfc2898DeriveBytes (C#) and crypto.pbkdf2 (JavaScript)
So I'm trying to use PBKDF2 to derive a key given a base64 string of 256bits. I am able to use C#'s Rfc2898DeriveBytes and node-crypto's pbkdf2 to derive the same key, however, I can't say the same for C++. I'm not sure if I'm doing wrong…

Chebn
- 63
- 1
- 5
6
votes
1 answer
For PBKDF2, using HMAC-SHA256 is more secure than using HMAC-SHA-1?
I'm looking for the proper Java algorithm for password encryption, and I found that Java SDK provides PBKDF2WithHmacSHA1, but not PBKDF2WithHmacSHA256.
I heard that HMAC-SHA256 will take more time than HMAC-SHA-1 does.
Since system resources are…

hotohoto
- 490
- 8
- 20
6
votes
2 answers
HMAC SHA1 Signature in Java
I am trying to interface with a TransUnion web service and I need to provide a HMAC-SHA1 signature to access it.
This example is in the TransUnion documentation:
Input of SampleIntegrationOwner2008‐11‐18T19:14:40.293Z with security
key…

Shane
- 2,629
- 6
- 32
- 39
5
votes
1 answer
MSDN HMAC-SHA1 example not working
Creating an HMAC steps by using CryptoAPI found here: http://msdn.microsoft.com/en-us/library/Aa379863
To compute an HMAC
Get a pointer to the Microsoft Cryptographic Service Provider
(CSP) by calling CryptAcquireContext.
Create a handle to an…

user954753
- 309
- 1
- 3
- 14
5
votes
0 answers
C# implement oauth 1.0 by using HMAC-SHA1 (without token)
I have tried to implement the Oauth 1.0 by using HMAC-SHA1 (without token details). While debug it, It's always return the following exception "The remote server returned an error: (401) Unauthorized". But the same credential works fine in…

Vengat
- 235
- 1
- 5
- 16