Questions tagged [sha-256]
SHA-256 is part of the SHA-2 family of hash functions with a 256-bit output and a 128-bit security level.
588
questions
101
votes
3
answers
119k
views
Why haven't any SHA-256 collisions been found yet?
I've been thinking about this for a few days, a SHA-256 algorithm outputs 64 characters which can either be a lowercase letter or a number from 0-9. Which should mean that there are 64^36 distinct SHA-...
94
votes
4
answers
25k
views
Has SHA256 been broken by Treadwell Stanton DuPont?
In a recent press release issued by Treadwell Stanton DuPont, the claim is made that their research laboratories have successfully broken all 64 rounds of the SHA256 hashing algorithm. They further ...
72
votes
6
answers
62k
views
SHA-512 faster than SHA-256?
I'm getting this strange result that SHA-512 is around 50% faster than SHA-256. I'm using .net's SHA512Managed and SHA256Managed ...
60
votes
3
answers
13k
views
Hashing or encrypting twice to increase security?
Over on the bitcoin forums I asked why the bitcoin client computes SHA-256(SHA-256(x)) as its cryptographic hash for a variety of purposes. The leading theory--since the bitcoin author has disappeared-...
60
votes
3
answers
26k
views
"SHA-256" vs "any 256 bits of SHA-512", which is more secure?
In terms of security strength, Is there any difference in using the SHA-256 algorithm vs using any random 256 bits of the output of the SHA-512 algorithm?
Similarly, what is the security difference ...
57
votes
11
answers
22k
views
How do hashes really ensure uniqueness?
This might seem an impractical and unnecessary conversation, but I feel it's something I need to clarify. Especially, as I just got my first developer job in a blockchain startup.
So hashes are said ...
44
votes
4
answers
16k
views
Cryptography algorithms that take longer to solve on a GPU than a CPU
I know that Graphics cards are faster at solving algorithms like SHA-256 because of the many builtin processors, but are there Algorithms that take actually longer on a Graphics card than on a modern ...
42
votes
4
answers
41k
views
Best way to reduce chance of hash collisions: Multiple hashes, or larger hash?
I would like to maintain a list of unique data blocks (up to 1MiB in size), using the SHA-256 hash of the block as the key in the index. Obviously there is a chance of hash collisions, so what is the ...
42
votes
4
answers
58k
views
How can hashes be unique if they are limited in number? [duplicate]
I'm curious, how can for example SHA-256 be unique if there are only a limited number of them?!
For clarification:
how many MD5 hashes are there?
$16^{32}$ MD5 hashes can be produced.
$16^{64}$ SHA-...
39
votes
2
answers
13k
views
How does hashing twice protect against birthday attacks?
The bitcoin wiki says:
Bitcoin is using two hash iterations (denoted SHA256^2 ie "SHA256 function squared") and the reason for this relates to a partial attack on the smaller but related SHA1 hash. ...
35
votes
2
answers
50k
views
HMAC-SHA1 vs HMAC-SHA256
I have three questions:
Would you use HMAC-SHA1 or HMAC-SHA256 for message authentication?
How much HMAC-SHA256 is slower than HMAC-SHA1?
Are the security improvements of SHA256 (over SHA1) enough to ...
35
votes
2
answers
62k
views
What is the difference between SHA-3 and SHA-256?
I am new about cryptography,
I learned that SHA-3 (Secure Hash Algorithm 3) is the latest member of the Secure Hash Algorithm family of standards, released by NIST....
35
votes
0
answers
48k
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 ...
33
votes
1
answer
8k
views
Should I use the first or last bits from a SHA-256 hash?
I have the need for a hexadecimal token that is smaller than the normal length of the hexadecimal representation of a SHA-256 hash.
Should I take the first bits or the last bits? Which of them ...
31
votes
2
answers
9k
views
Fixed point of the SHA-256 compression function
SHA256 Free Start Self Collision (Full 64 rounds)
IVec:
72BF9EF1 27B82DFB F298F3B7 22B6C32C 18A54860 4C032D91 ADD7B85B 7ED1A4AC
Block:
...
28
votes
7
answers
11k
views
Is calculating a hash code for a large file in parallel less secure than doing it sequentially?
I would like to improve the performance of hashing large files, say for example in the tens of gigabytes in size.
Normally, you sequentially hash the bytes of the files using a hash function (say, ...
27
votes
1
answer
10k
views
Why hashing twice?
I'm trying to understand the Bitcoin protocol, and sometimes see instructions like this:
The TransactionId is defined by SHA256(SHA256(txbytes))
or
The hash of the public key is generated by ...
26
votes
3
answers
10k
views
"Weaknesses" in SHA-256d?
According to this answer, "SHA-256d" was proposed in one of the Ferguson/Schneier books like so:
SHA-256d(x) = SHA-256(SHA-256(x))
Apparently, the motivation for ...
24
votes
3
answers
17k
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 ...
23
votes
1
answer
38k
views
SHA-256 hash of null input?
What is the SHA-256 hash if the input is null, i.e. an empty bitstring? (Not the hash of 0 or "0".)
23
votes
2
answers
10k
views
What makes SHA-256 secure?
For example, RSA relies on a mathematically hard problem, factoring, while ECDSA or similar rely on discrete logarithm problem.
What makes SHA-256 and similar hash functions, of the same family, ...
22
votes
4
answers
3k
views
Cycles in SHA-256
Let's say I start with a particular 256 bit value. Call this $v$. I then hash that value, and get another 256 bit value. Call this $\text{SHA256}(v)$. I take this value and get another 256 bit value. ...
21
votes
1
answer
19k
views
Are there any well-known examples of SHA-256 collisions?
The popularity of SHA-256 as a hashing algorithm, along with the fact that it has 2256 buckets to choose from leads me to believe that collisions do exist but are quite rare.
Are there any well-...
19
votes
5
answers
3k
views
How many hex digits do I need to compare when manually checking hash functions?
I sometimes run sha256sum on large files after transferring them from one place to another, and will just skim the hash output to verify it's correct. But, I usually just look at the first/last 5 or 6 ...
19
votes
2
answers
18k
views
How fast can a SHA-256 implementation go?
I'm looking for high-speed SHA-256 implementations, and specifically, ones with low latency; that is, the time between when you submit the message block, and when the output (or internal state) is ...
18
votes
5
answers
10k
views
Is it easy to crack a hashed phone number?
I want to SHA256 hash phone numbers in order to hide them. Is this a good idea? Are there any other ways I could make this safe?
18
votes
1
answer
5k
views
What are the consequences of removing a single byte from a sha256 hash?
I'm working on a system (Ethereum) where it is significantly cheaper to store 32 bytes than 33 bytes. I'd like to create a table where data is stored based on its hash.
Sha256 would meet this ...
18
votes
2
answers
9k
views
SHA-256: (Probabilistic?) partial preimage possible?
Currently busying myself with the Bitcoin "mining" algorithm, I am wondering if the process really cannot be simplified.
For reference, the algorithm is basically SHA-256d:
$$\mathit{success} := \...
17
votes
2
answers
60k
views
Do identical strings always have the same SHA-256 value?
If you hash a string using SHA-256 on your computer, and I hash the same string using SHA-256 on my computer, will we generate the same value? Does the algorithm depend on a seed (so we'd both need ...
16
votes
2
answers
2k
views
Why is the salt used only once in PBKDF2, while the password is used often?
The purpose of PBKDF2 is to create a derived key (DK) from a master password (PW) and a salt, often using a function like HMAC-SHA256. I have read that the salt should be as random as possible. But ...
15
votes
1
answer
19k
views
Are hash functions strong against quantum cryptanalysis and/or independent enough of mathematics?
I work on ethereum and other blockchain technologies. And seeing that quantum pc's are someday going to see the light I have some questions / doubts.
I was wondering if hash functions are strong ...
15
votes
4
answers
3k
views
Is there a way to use bcrypt with passwords longer than 72 bytes securely?
From my understanding BCrypt truncates the password to 72 bytes. If a password is longer than 72 bytes, what is a way to store that password using bcrypt securely without compromising it? Or is this ...
15
votes
3
answers
6k
views
At the current time, is SHA256 the de facto standard for strong cryptographic hashes?
At the current time, is SHA256 the de facto standard for strong cryptographic hashes?
From what I am seeing of more sites utilizing it, I would suppose the answer to this is yes, but would like to ...
15
votes
4
answers
15k
views
How to deal with collisions in Bitcoin addresses?
When creating a Bitcoin account, you need to issue a couple of private/public ECDSA keys. Then, you derive your account address by taking a 160-bit hash (through SHA-256 and RIPEMD) of the public key ...
14
votes
2
answers
26k
views
SHA-256 "almost unique"?
I have seen numerous references on the internet of people describing SHA-256 as generating an "almost unique" hash.
Exhibit A. there are more.
Is there some mathematical basis to the almost ...
14
votes
3
answers
12k
views
How can I calculate the SHA-256 "midstate"?
Recently I've been trying to implement some Bitcoin-related code, and I've stumbled upon a weird concept, a SHA-256 "midstate". Some explanation is given here.
The general concept is that Bitcoin ...
14
votes
2
answers
2k
views
The effect of truncated hash on entropy
Suppose I have a 128-bit random binary string (128 bits of entropy), then I hash it using SHA-256, then I take the first 128 bits of the output hash. Does the taken bit string still have (almost) 128 ...
13
votes
1
answer
8k
views
What does Maj and Ch mean in SHA-256 algorithm?
I'm guessing they're some kind of standard function but what do they do and what do the names mean? A little explaination or link me to an article would be great.
13
votes
1
answer
11k
views
Is there any benefit from using SHA-512 over SHA-256 when AES just truncates it anyway?
I am still not very clear on how AES-256-CBC can use SHA-512 bit keys, but I assume that it just truncates the 512bit hash down to 256bit.
In software like GnuPG and OpenPGP, is there any real benefit ...
13
votes
2
answers
4k
views
Efficient Incremental Updates to Large Merkle Tree
I have a data set with 300 Million entries and every 5 minutes 4000 random entries in this table change. I need to calculate the merkle root on this data set to validate integrity multiple times ...
13
votes
2
answers
13k
views
128 bit hash with least chance of collision?
I'm building a storage system for JSON documents where they are looked up on a 128 bit key. These JSON documents have a timestamp within them, but apart from that are user-entered data. These JSON ...
12
votes
1
answer
2k
views
Why does SHA2-224 use different IV's than SHA2-256?
Given that it's otherwise just a truncation, I can guess that being able to compute the 224 value from the 256 value is an unwanted property, but that's just speculation.
12
votes
1
answer
24k
views
Probability of SHA256 Collisions for Certain Amount of Hashed Values
I wonder if you can help me figure out that question:
Is there a known probability function f: N -> [0,1], that computes the probability of a sha256 collision for a certain amount of values to be ...
12
votes
1
answer
507
views
Does SHA-512 leak info about SHA-256?
Does the SHA-512 value of an input leak any information about the SHA-256 value of that same input?
Specifically, if I'm using SHA-512 to derive encryption and HMAC keys from a 256 bit ECDH shared ...
11
votes
3
answers
13k
views
SHA256 output to 0-99 number range?
Is it mathematically possible to take a SHA256 hash and turn it into a 0-99 number where each number in 0-99 range is equally likely to be picked?
As a 256 bit hash means the highest value possible ...
11
votes
1
answer
15k
views
Should I use SHA256 or Blake2 to checksum and sign scrypt headers?
I use scrypt as a key derivation function (not to store passwords). To pass around the detached key header I use the standard encoding as implemented in Colin Percival's scrypt implementation (...
11
votes
1
answer
815
views
Minimizing exchanges for ZK proof of a message with given SHA-256
Consider the problem of proving knowledge of a message $m$ which has a certain public SHA-256 hash $h$, without disclosing $m$ or usable information about it, while minimizing the information exchange ...
11
votes
1
answer
3k
views
Using SHA-256 with different initial hash value
FIPS 180-3 defines the initial hash value for SHA-256 as the first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19. What would be the risks of using a different value (...
10
votes
3
answers
5k
views
Is double SHA-256 the best choice for Bitcoin?
So I was just curious.
I really look up to Blockchain technology and I have read that Bitcoin uses double SHA-256 for hashing.
( from what I understood, double sha256 is essentially $\operatorname{SHA-...
10
votes
2
answers
828
views
Which attacks are prevented by the different initial hash values for SHA-2 with truncated output?
NIST specified SHA-2 hash functions with truncated output. Those hashes use different initialization values than SHA-256 or SHA-512. SHA-224 is based on SHA-256. SHA-384, SHA-512/224 and SHA-512/256 ...