Questions tagged [sha]

SHA (Secure Hash Algorithm) is a family of digest algorithms (i.e. cryptographic hashes), i.e. checksum functions that are hard to forge. The recommended digest algorithms these days are SHA-1 and SHA-2 (which covers both SHA-256 and SHA-512). MD5 is a deprecated alternative.

SHA is a family of cryptographic hash functions (i.e. cryptographic digests). That is, they are checksum functions (producing a fixed-size output for an (almost) arbitrary-sized input), with no known way to find two inputs with the same checksum or to recover the input given the checksum.

The SHA algorithms are specified by the U.S. standard body NIST's publication FIPS-180. There have been several versions of SHA; both SHA-1 and SHA-2 are currently in widespread use:

  • SHA-0: withdrawn in favor of SHA-1 due to an undisclosed flaw
  • SHA-1 : a widely-used algorithm with a 160-bit result, published in 1993. SHA-1 is currently deprecated in favor of SHA-2, although it is still approved for many official uses and no serious flaw is known.
  • SHA-2 : a family of four similar algorithms with different output sizes: SHA-256, SHA-512, and the less common variants SHA-224 and SHA-384. It was published in 2002.
  • SHA-3 : the future successor of SHA-1 and SHA-2, which is scheduled to be selected by NIST in 2012 amongst candidates (the selection is now down to 5 competitors).

MD5 is an earlier cryptographic digest algorithm, now deprecated because collisions have been found, but still used in legacy systems.

1323 questions
46
votes
4 answers

Suppress Firefox/Firebug SHA-1 warning

I use Firebug for web development. Since version Firefox 37 I see the following annoying message in my console: This site makes use of a SHA-1 Certificate; it's recommended you use certificates with signature algorithms that use hash functions…
Sergey Kravchenko
  • 957
  • 1
  • 8
  • 21
45
votes
7 answers

Hashing in SHA512 using a salt? - Python

I have been looking through ths hashlib documentation but haven't found anything talking about using salt when hashing data. Help would be great.
RadiantHex
  • 24,907
  • 47
  • 148
  • 244
41
votes
3 answers

Why does git commit --amend change the hash even if I don't make any changes?

Why does the SHA-1 hash of my latest commit change even if I don't make any changes to the commit (message, files) after running git commit --amend? Say I run the following at the command line. cd ~/Desktop mkdir test_amend cd test_amend git…
jub0bs
  • 60,866
  • 25
  • 183
  • 186
39
votes
4 answers

How to find a Github file 's SHA blob

I'm using this API to update a file on my repo, it requires me to have a valid SHA blob for a file that I want to update: http://developer.github.com/v3/repos/contents/ How do I find the SHA blob for the specific file? Supposed in my testrepo in the…
Kiddo
  • 1,910
  • 8
  • 30
  • 54
39
votes
4 answers

Does every Android phone support SHA-256

So reading this post: How can I calculate the SHA-256 hash of a string in Android? and the docs: http://developer.android.com/reference/java/security/MessageDigest.html I'm curious; which phones will support SHA-256? In the docs, the line about the…
joshkendrick
  • 3,497
  • 8
  • 38
  • 52
38
votes
3 answers

Compute SHA256 Hash in Android/Java and C#

I am trying to generate a SHA256 hash in android, that I then pass to an ASP.NET Web API web service and compare the hash there. As such, I need to construct a hash in Android, that given the same inputs in ASP.NET will generate an equivalent hash.…
Kevin
  • 895
  • 2
  • 10
  • 21
33
votes
3 answers

Java: How to create SHA-1 for a file?

What is the best way to create a SHA-1 for a very large file in pure Java6? How to implement this method: public abstract String createSha1(java.io.File file);
Witek
  • 6,160
  • 7
  • 43
  • 63
32
votes
4 answers

Why does Zipping the same content twice gives two files with different SHA1?

I have run into a strange problem with git and zip files. My build script takes a bunch of documentation html pages and zips them into a docs.zip I then check this file into git. The problem I am having is that every time I re-run the build script…
ams
  • 60,316
  • 68
  • 200
  • 288
31
votes
7 answers

Create SHA-256 hash from a Blob/File in javascript

I need to create a SHA-256 digest from a file (~6MB) inside the browser. The only way that I've managed to do it so far was like this: var reader = new FileReader(); reader.onload = function() { // this gets rid of the mime-type data header …
Gabi Purcaru
  • 30,940
  • 9
  • 79
  • 95
30
votes
4 answers

Are there in x86 any instructions to accelerate SHA (SHA1/2/256/512) encoding?

An example, in x86 are Instruction Set to hardware acceleration AES. But are there in x86 any instructions to accelerate SHA (SHA1/2/256/512) encoding, and what library is the fastet to encoding SHA on x86?
Alex
  • 12,578
  • 15
  • 99
  • 195
29
votes
4 answers

How to Generate an MD5 hash in Kotlin?

Generate MD5 hash of a string using standard library in Kotlin? I have tried below mention code import java.math.BigInteger import java.security.MessageDigest fun md5(input:String): String { val md = MessageDigest.getInstance("MD5") return…
Anisuzzaman Babla
  • 6,510
  • 7
  • 36
  • 53
27
votes
5 answers

When generating a SHA256 / 512 hash, is there a minimum 'safe' amount of data to hash?

I have heard that when creating a hash, it's possible that if small files or amounts of data are used, the resulting hash is more likely to suffer from a collision. If that is true, is there a minimum "safe" amount of data that should be used to…
PeterM
  • 2,534
  • 6
  • 31
  • 38
27
votes
3 answers

JWT (JSON Web Token) in PHP without using 3rd-party library. How to sign?

There are a few libraries for implementing JSON Web Tokens (JWT) in PHP, such as php-jwt. I am writing my own, very small and simple class but cannot figure out why my signature fails validation here even though I've tried to stick to the standard.…
BeetleJuice
  • 39,516
  • 19
  • 105
  • 165
26
votes
4 answers

When should I use SHA-1 and when should I use SHA-2?

In my c# application, I'm using RSA to sign files before being uploaded on the database of my company by the person who is uploading and here I have to choose SHA-1 or SHA-2 for computing the hash. As any other component in programming, I know that…
Majd
  • 1,358
  • 3
  • 15
  • 29
26
votes
2 answers

How to update Homebrew SHA256?

This seems like a very noob question but I can't find an answer anywhere! I'm very new to developing packages for Homebrew but when I edit my formula and come to update my package I get the following error Error: SHA256 mismatch My question is, how…
Alex Chesters
  • 3,380
  • 5
  • 19
  • 27
1
2
3
88 89