Questions tagged [sha1]

SHA-1 is a cryptographic hash function designed by the U.S. Government as a Federal Information Processing Standard. Recently, collisions have been detected, meaning that SHA1 is becoming more vulnerable to attacks, and its use for protecting data is not recommended.

NOTE: Sha1 is no longer secure due to collisions being found. It is recommended you use or another hashing system like

In cryptography, SHA-1 is a cryptographic hash function designed by the National Security Agency (NSA) and published by the NIST as a U.S. Federal Information Processing Standard. SHA stands for Secure Hash Algorithm. The three SHA algorithms are structured differently and are distinguished as SHA-0, SHA-1, and SHA-2. SHA-1 is very similar to SHA-0, but corrects an error in the original SHA hash specification that led to significant weaknesses. The SHA-0 algorithm was not adopted by many applications. SHA-2 on the other hand significantly differs from the SHA-1 hash function.

SHA-1 is the most widely used of the existing SHA hash functions, and is employed in several widely-used security applications and protocols. In 2005, security flaws were identified in SHA-1, namely that a mathematical weakness might exist, indicating that a stronger hash function would be desirable. Although no successful attacks have yet been reported on the SHA-2 variants, they are algorithmically similar to SHA-1 and so efforts are underway to develop improved alternatives. A new hash standard, SHA-3, is currently under development — an ongoing NIST hash function competition is scheduled to end with the selection of a winning function in 2012.

References:

1825 questions
61
votes
5 answers

Why does git hash-object return a different hash than openssl sha1?

Context: I downloaded a file (Audirvana 0.7.1.zip) from code.google to my Macbook Pro (Mac OS X 10.6.6). I wanted to verify the checksum, which for that particular file is posted as 862456662a11e2f386ff0b24fdabcb4f6c1c446a (SHA-1). git hash-object…
twcamper
  • 633
  • 1
  • 5
  • 6
60
votes
5 answers

HMAC-SHA1: How to do it properly in Java?

I'm hashing some values using HMAC-SHA1, using the following code in Java: public static String hmacSha1(String value, String key) { try { // Get an hmac_sha1 key from the raw key bytes byte[] keyBytes = key.getBytes(); …
Mark
  • 67,098
  • 47
  • 117
  • 162
58
votes
8 answers

SHA1 Key for DEBUG & RELEASE ANDROID STUDIO MAC , How to generate SHA1 Release Keys in Mac?

How do I get my SHA1 Keys for debug and release using android studio on a mac? (These are required for Google API Keys)
andyc101
  • 2,203
  • 2
  • 15
  • 8
57
votes
8 answers

Implementation HMAC-SHA1 in python

I am trying to use the OAuth of a website, which requires the signature method to be 'HMAC-SHA1' only. I am wondering how to implement this in Python?
xiaohan2012
  • 9,870
  • 23
  • 67
  • 101
55
votes
4 answers

Git - finding the SHA1 of an individual file in the index

I've added a file to the 'index' with: git add myfile.java How do I find out the SHA1 of this file?
git-noob
  • 5,757
  • 11
  • 34
  • 32
55
votes
8 answers

Compute SHA-1 of byte array

I'm looking for a way of getting an SHA-1 checksum with a Java byte array as the message. Should I use a third party tool or is there something built in to the JVM that can help?
Mike
  • 58,961
  • 76
  • 175
  • 221
54
votes
4 answers

Google Maps API for Android, getting SHA1 cert instead of MD5

When I try to get the MD5 fingerprint using keytool, I get a SHA1 fingerprint instead and the Google Maps doesn't recognize it. How do I get the MD5 fingerprint?
Brahadeesh
  • 2,245
  • 8
  • 40
  • 58
53
votes
6 answers

A Regex to match a SHA1

I'm trying to match SHA1's in generic text with a regular expression. Ideally I want to avoid matching words. It's safe to say that full SHA1's have a distinctive pattern (they're long and a consistent length) - so I can match these reliably - but…
git-noob
  • 5,757
  • 11
  • 34
  • 32
52
votes
2 answers

How to generate an HMAC in Java equivalent to a Python example?

I'm looking at implementing an app getting Twitter authorization via Oauth in Java. The first step is getting a request token. Here is a Python example for app engine. To test my code, I am running Python and checking output with Java. Here is an…
dfrankow
  • 20,191
  • 41
  • 152
  • 214
51
votes
5 answers

Check if my SSL Certificate is SHA1 or SHA2

I have tried to find the answer to this but I couldn't find an answer... How do I check if my SSL Certificate is using SHA1 or SHA2? Reason I ask is because it might have to do with the certificate not loading on Mozilla Browers.... Any ideas? Can I…
Henry
  • 5,195
  • 7
  • 21
  • 34
50
votes
5 answers

What are the chances that two messages have the same MD5 digest and the same SHA1 digest?

Given two different messages, A and B (maybe 20-80 characters of text, if size matters at all), what is the probability that the MD5 digest of A is the same as the MD5 digest of B and the SHA1 digest of A is the same as the SHA1 digest of B? That…
John Siracusa
  • 14,971
  • 7
  • 42
  • 54
48
votes
6 answers

Git - finding a filename from a SHA1

I added a file to the index with: git add somefile.txt I then got the SHA1 for this file with: git hash-object somefile.txt I now have a SHA1 and I would like to retrieve the filename of the object in the index using the SHA1. git show…
git-noob
  • 5,757
  • 11
  • 34
  • 32
45
votes
6 answers

Why is a SHA-1 Hash 40 characters long if it is only 160 bit?

The title of the question says it all. I have been researching SHA-1 and most places I see it being 40 Hex Characters long which to me is 640bit. Could it not be represented just as well with only 10 hex characters 160bit = 20byte. And one hex…
AGrunewald
  • 1,735
  • 3
  • 16
  • 25
43
votes
7 answers

Creating SHA1 Hash from NSString

How can I create a SHA1 from a NSString. Let's say the NSString is set up as: NSString *message = @"Message"; I can use PHP to create a SHA1 hash with sha($message). But unfortunately it doesn't work like that within Objective-C.
Alex van Rijs
  • 803
  • 5
  • 17
  • 39
43
votes
1 answer

RSA signature size?

I would like to know what is the length of RSA signature ? Is it always the same size as the RSA key size like if the key size is 1024 then RSA signature is 128 bytes , if the key size is 512 bits then RSA signature is 64 bytes ? what is RSA modulus…
user839917
  • 851
  • 5
  • 13
  • 20