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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
39 views

How do bad actors manipulate game results in real time within 'provably fair' gaming systems?

Ive been assigned research involving online gaming companies and their use of cryptographic algorithms to produce 'provably fair' results. The largest player in the industry uses a method involving a ...
1 vote
1 answer
153 views

Is the sha256 x86 extension close to optimal in silicon? (as it relates to a VDF)

I came across the Solana network utilizing sha256 as a "proof of history". They are using it as a pseudo-VDF (verifiable delay function). The reason it's pseudo is because verification is ...
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-...
1 vote
2 answers
1k views

Why is SHA256 used as a layer on top of Digital Signature [duplicate]

Digital Signatures use an asymmetric algorithm, meaning that if I want to apply a digital signature to a document I sign it with my own private key and send it to the recipient. The recipient, thanks ...
2 votes
2 answers
128 views

In sha256, is it possible to use less information than the full preimage to prove that the prefix of the preimage is a certain string

Alice split a long string P into two segments A and B. A is relatively short and B is long. H = sha256(A + B) Bob does not know P, but knows H. Is it possible for ...
0 votes
1 answer
173 views

TLS1.3 transcript hash

From RFC8446: For concreteness, the transcript hash is always taken from the following sequence of handshake messages, starting at the first ClientHello and including only those messages that were ...
1 vote
2 answers
230 views

Hash coordinates (back-end) without the client (front-end) knowing the coordinates, but to be able to guess them

So I have a set of coordinates and I will hash these with a random salt with SHA256. Coordinate range is 0,100. ...
1 vote
2 answers
3k views

How weak is using AES with a 128 bit key but 64 bits of the secret key are public constants?

Respected community, I was wondering how weak would AES-128 be, if we provide only a 64 bit key with the other remaining 64 bits either zero bits or public constants, known to the attacker. Is it easy ...
0 votes
1 answer
210 views

Why hash algorithms have many different digest size variants?

1- Why SHA2 has SHA224, SHA256, SHA384 and SHA512 variants? 2- Can we say SHA512 more secure than SHA256? 3- Symmetric ciphers use at most 2^256 security level and I saw on the internet people saying ...
1 vote
0 answers
100 views

Zero Knowledge Proof for SHA-256 preimages [duplicate]

I need to design some protocol where actors will leverage Zero Knowledge Proofs (ZKP) to prove that they know the pre-image of some specific SHA256 hash without revealing the pre-image itself. Ideally,...
1 vote
0 answers
84 views

Is it better to use PBKDF2 with SHA-512 and 1e6 iterations or SHA-256 and 6e6 iterations?

I'm implementing encryption in my browser extension that will allow users to encrypt their data and then share them with others. And since shared links can be leaked, I want to protect the data as ...
4 votes
2 answers
2k views

What is SHA-256 in Conjunctive Normal Form?

What is the conjunctive normal form (CNF) representation of $\text{SHA-256}(m)=h$, where $m$ is of fixed (or bounded) size and $h$ is 256 bit?
0 votes
0 answers
108 views

HMAC-SHA256 key length against key recovery attack

I have trouble finding information on the security strength of HMAC-SHA256 against key recovery attacks with respect to the key size. To fit a certain application I must use a 128-bits key with a HMAC-...
1 vote
2 answers
3k views

Can I update sha-256 digest chunk-wise instead of the whole array at once?

I'm not sure whether this questions is about SHA-256 algorithm itself or the particular implementation I'm using. Usually, a hash algorithm implementation has functions, let us call them update and ...
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 ...
1 vote
2 answers
40 views

Let $X$ be the set of 256-bit strings and $x \rightarrow H(x)$ a map on this set, where $H$ is SHA-256. How often is $H^-1(y)$ empty?

It cannot be "frequent" because that implies $H$ is not really 256-bit. Are there statistical or mathematical bounds on this? Finding the inverse is computationally difficult, but what ...
5 votes
2 answers
31k views

Calculation of time to crack a SHA-256 hash

A problem is given: 1 million users are authenticated with 9-digit PIN codes (e.g. 343534643). The PIN values are stored as hash values in a database. The hash is SHA-256, and is computed as: ...
2 votes
1 answer
289 views

HMAC SHA256 walkthrough examples

I'm trying to implement HMAC SHA256 (I've implemented SHA256 successfully). I am trying to find examples where they show the results after each HMAC stage (XOR, append, H etc). Does anyone know of any ...
0 votes
0 answers
47 views

Explanation of KeePass 2 database key calculation?

I am currently taking a course in university where we are working with a KeePass 2 database file. I am still very new to everything which has to do with encryption. First I am going to provide the ...
-2 votes
1 answer
104 views

What is the critical importance of SHA and other hash families? [closed]

Assume integer factoring, discrete log are classical safe and LWE, McEliece etc are quantum safe. This question is only about SHA and hash families in general on why we need them if we have pkc ...
8 votes
3 answers
25k views

Can two files/strings have the same SHA-256 value?

I was wondering whether, theoretically, 2 files can have the same SHA-256 value. Since there are only $16^{256}$ or $2^{1024}$ SHA256 sums, all 1024-bit files (with $2^{1024}$ different combinations) ...
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 ...
1 vote
0 answers
63 views

Inconsistent SHA256 checksums [closed]

I encounter an odd issue when I calculate SHA256 checksums in Javascript. I use the following code: ...
1 vote
1 answer
109 views

Collision Resistance in Random Bit Generator

Consider following simple RBG where SHA-256 of random noise (more than 200Bytes of 4 bits entropy per byte) is computed to produce 256 output bits $\text{output} = \operatorname{SHA-256}(\text{...
2 votes
3 answers
470 views

What happens if a padding sequence is encountered at the end of input for SHA-256?

I am acquiring binary data from a sensor and storing it in a file. As each byte of data is read from the sensor, it goes into a SHA256 hash. The length of the acquired data stream varies from one ...
2 votes
1 answer
153 views

Implementing a Merkle tree using a 128 bit hash function?

I need to implement a Merkle tree using a 128 bit hash function. In general, any hash function that guarantees pre-image, second pre-image and collission resistance should be fine to implement a ...
2 votes
1 answer
650 views

When using AES-256 in combination with HMAC-SHA, should we use SHA-256 or SHA-512?

When using AES-256 (cipher mode CBC and padding mode PKCS7) in combination with HMAC-SHA for authenticated encryption (assuming alternatives like TLS and AES-GCM cannot be used), should we use SHA-...
1 vote
1 answer
629 views

What does the 256 in SHA3-256 and SHAKE256 refer to?

I am simply wondering what the bit-length in the algorithm variant in the table below refers to? For the hash functions I assume that this refers to the ouput length in bits. For instance for SHA3-256 ...
0 votes
2 answers
882 views

Is it possible to break SHA-256 with hash tables?

If x is the value you're hashing, $t(x)$ is the hash of that value, and $t(x+s)$ is that value with salt, then hashed. You could create a hash table where the key is $t(x+s)$, the value is $x+s$, and ...
5 votes
2 answers
2k views

Is there a way to calculate a hash with two people so that no one knows the pre-image but if they get together they do?

I'm trying to find a way to have multi party hash computation, more specifically for SHA256. I want for two people to be able to compute a hash so that none of them knows the pre-image but when they ...
-2 votes
1 answer
178 views

Does a pseudo-random number have the same security as its SHA digest message?

Is a random number generated by a CSRNG equivalently secure as the SHA hash of that number? I know that RNGs generate numbers that look random, and aren't necessarily random. For example, in a range ...
0 votes
2 answers
2k views

How is the hash for a file calculated?

Is the file just read bit by bit to calculate the hash with those values or is there more to it? Are there any resources to read a bit more about file hashing?
1 vote
0 answers
208 views

Is my TypeScript scrypt implementation using Web Crypto API safe and correct? (Open Source)

I want to use TweetNaCl.js for encrypting user data that is stored in LocalStorage. Therefore, I want to prompt the user to provide a PIN/password that shall be ...
1 vote
1 answer
111 views

Fastest method of CNF equation solution verification

I am trying to find a way to mine bitcoin faster than an ASIC by using a CNF representation of sha(sha(hash)), which would be an equation containing a few hundred thousand clauses, let's call it n ...
1 vote
2 answers
722 views

Concatenation in Merkle Trees

Consider a simple Merkle Tree with leaves alice +100 and bob +50. Using the SHA256 hash algorithm, the digest of the respective ...
1 vote
0 answers
45 views

Verifying ECDSA-SHA256 HTTP Signature [duplicate]

With PHP, I'm trying to setup a HTTP signature verification for webhook requests coming from BlockCypher: https://www.blockcypher.com/dev/bitcoin/?php#webhook-signing This is their public key: ...
2 votes
1 answer
769 views

is this how RS256 works in JWT?

I'm a newbie that is studying about JWT using RS256 algorithm for signing and verification. I have drawn a diagram that represents my understanding of how RS256 works. Basically, below is what I ...
3 votes
2 answers
386 views

is SHA512 with 256 bit set is similar or same as SHA256?

I'm new in Cryptography, if i will use SHA512, but only with 256 bits, is it equal or similar to SHA256? I'm trying to understand if there is a way to use SHA512 as SHA256
1 vote
4 answers
1k views

How long would it take all of the supercomputers or cloud computing on Earth to bruteforce a significantly long password?

I was arguing with a colleague who thinks that SHA256 (password + 64 character static salt) is "insecure." My argument is that nothing in cryptography is "secure," it's all a ...
0 votes
1 answer
81 views

Correlation between IV value and the output of a hash function

As we know, the IV and the output of SHA-256 are identical in size. Suppose the input value to the SHA-256 is completely transparent. Is there any correlation between IV value and output? Is it ...
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 ...
8 votes
1 answer
184 views

AES vs. SHA2 in key-stream generation

A KDF in Counter Mode (e.g., see NIST SP 800-108r1, Section 4.1, similar to HKDF) produces the output as what AES-CTR would do if one replaces AES with SHA2 (or, to be exact, with HMAC). However, NIST,...
1 vote
1 answer
230 views

How do most implementations of SHA-256 work?

Why is it that most implementations define an sha256_init, sha256_update, and sha256_final ...
3 votes
1 answer
957 views

Why does SHA-256 have any to do with scrypt?

I was reading the Wikipedia page for scrypt because I wanted to learn more about it and I came across their pseudocode for the algorithm. What confused me was the following line: I don't understand ...
1 vote
1 answer
88 views

Is there any point in extending an 80-bit key before using it for HMAC-SHA256?

I have been asked to make a HMAC-SHA256 password digest from: a password some salt, and an 80-bit secret key. I've been advised that I should be using a key of 256 bits or more for HMAC-256. The key ...
4 votes
2 answers
1k views

Embedding SHA256 inside SHA1 for BitTorrent

BitTorrent uses SHA1 for its hashes, but SHA1 is unsafe and people can tamper the preimage and still obtain the same hash, right? So imagine I want to be very sure the file I'm sharing on BitTorrent ...
3 votes
2 answers
836 views

Password Hashing based on Common Passwords

If an attacker has a database of 1,000 users' hashed passwords which are hashed with SHA-256 with a 128-bit salt and all of these users used 10,000 common passwords. How many hashes will the hacker ...
1 vote
0 answers
287 views

What is more secure, HMAC with SHA-1, or with SHA-256 and take a substring?

I'm going to guess the latter, but just wanted to ask here. I want to have a relatively short signature, and my goal is to take a substring of the resulting hash.
1 vote
4 answers
395 views

Possible SHA-256 implementation weakness

I came across a SHA-256 implementation that seems not to conform to the standard and because I can't change the implementation I would like to know if it's safe for use or can be a potential weakness. ...
5 votes
1 answer
641 views

How can a preimage attack on SHA-256 always succeed within 2^256 evaluations when done though brute force?

I was reading the Wikipedia page for SHA-256 (SHA-2) and came across the following statement: For a hash function for which $L$ is the number of bits in the message digest, finding a message that ...

1
2 3 4 5
12