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
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 ...
1
vote
1
answer
152
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 ...
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
204
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
99
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
83
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 ...
0
votes
0
answers
97
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
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 ...
2
votes
1
answer
268
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
46
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 ...
1
vote
0
answers
59
views
Inconsistent SHA256 checksums [closed]
I encounter an odd issue when I calculate SHA256 checksums in Javascript. I use the following code:
...
2
votes
1
answer
149
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
634
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
606
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 ...
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{...
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 ...
1
vote
0
answers
202
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
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
735
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
379
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
0
votes
1
answer
80
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 ...
1
vote
1
answer
225
views
How do most implementations of SHA-256 work?
Why is it that most implementations define an sha256_init, sha256_update, and sha256_final ...
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,...
3
votes
1
answer
954
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 ...
3
votes
2
answers
829
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
285
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.
5
votes
1
answer
639
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
vote
1
answer
101
views
Mod operation while verifying an ECDSA signature with SECT233R1
I'm trying to perform ECDSA verification in hardware. I'm using the SECT233R1 curve (NIST B-233). I have a question about the hash function used while doing so.
I want to use the SHA256 hash function ...
2
votes
1
answer
217
views
Generic attack on Hmac sha256
Is there any generic attack on HMAC SHA 256 ?
I am currently reading up on attacks on Hmac sha-256. However most of the papers I've found are about side channel attacks such as Differential power ...
4
votes
2
answers
1k
views
Password hashing and salting with SHA-256 on $2^{64}$ password space
If a password is randomly chosen from a space of $2^{64}$ passwords and is stored as an SHA-256-bit hash and a 128-bit salt, how many hashes does an attacker need to perform to recover the password in ...
1
vote
1
answer
386
views
Which hash functions provide 128 bit resistance?
I was wondering out of the functions (MD5, SHA-1, SHA-256, and SHA-512), do all provide 128-bit pre-image resistance and 128-bit second-image resistance?
Also, out of these hash functions, do only SHA-...
1
vote
1
answer
1k
views
How long does it take to decrypt AES encrypted message with salt(for pbkdf2 key) and iv known
I'm new to crypto!
The situation is,
Aes-256-cbc encrypted message(including not encrypted iv & salt) is revealed.
We also know pbkdf2 function uses 10000 rounds with sha256.
All we need to ...
-2
votes
1
answer
177
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 ...
-1
votes
2
answers
749
views
Can I 100% trust the PBKDF2(HMAC-SHA256) AES-256 CBC encryption algorithm for file encryption purposes or not, and why? (Winrar) [closed]
I am not an expert in cryptography and therefore I would like to address this problem to people who have been working on this topic for a long time and thus verify the facts from several sources.
I ...
1
vote
1
answer
576
views
Is sha-256 better then sha-1 in aspects othen then the hash size?
Assume I create a hash using SHA-256 and then take only the first 160 bits of the hash, as the result. is the result more cryptographically secured than SHA-1? Or are the two algorithms equally secure ...
8
votes
1
answer
746
views
Does "SHA-256/192" use different initial values from SHA-256?
I've seen some mentions of a "SHA-256/192" online. Clearly, this means the output of SHA-256 is truncated to 192 bits, but does it also use different Initial Values like SHA-512/256?
0
votes
2
answers
672
views
PKCS#7 SignedData - how is the "encryptedDigest" constructed for RSAES‐PKCS‐v1_5?
I need to use Azure Key Vault HSM to sign arbitrary data in a PKCS#7 CMS. There are plenty of libraries and packages that can do this if you supply them with the private key, but obviously I don't ...
0
votes
1
answer
141
views
Merkle–Damgård construction - the bigger input, the longer time to compute hash?
I'm trying to understand Merkle–Damgård construction. We can hash as many blocks of data as we want, if I understand it right. But then it looks like when input is bigger, then also time to compute ...
0
votes
2
answers
303
views
SHA256 - alternative algorithm to receive same hash?
My question is whether it is possible to use "another" algorithm than the sha256 to hash data but end up with the identical sha256 hash (obviously without using the sha256 algorithm)?
2
votes
1
answer
274
views
Create a control hash string from different sources, is there a difference, advantage or disadvantage in comparison when using this ways?
I wanna create from several inputs/sources should be formed into one hash value for controlling of different thinks later.
Example:
String + File
String + String
File + File
String + File + String
...
0
votes
0
answers
804
views
Generate SHA256 fingerprint from RSA public key (string only)
I have the public key, the string itself (not a file), and I am trying to figure out the SHA256 fingerprint, as in the image attached. The default key generated by PuttyGen is SSH-2 RSA with a SHA256 ...
0
votes
0
answers
165
views
What is the minimum length of shortened HMAC to be considered safe?
Is it safe to truncate HMAC? What is the minimum length of a truncated HMAC so that HMAC is still considered to be safe to use? Are there any standards on when it comes to shortening HMAC?
In my case, ...
0
votes
1
answer
168
views
Should I use hash of passphrase as AES256 key
As title I have a password-like passphrase (8 chars at least) that is then hashed with argon2(with the salt is SHA256 of that passphrase).
Then use it as AES256 key along with a random IV generated by ...
4
votes
1
answer
205
views
What is the rationale for including addition in SHA-256?
Short Version: SHA-256 uses addition alongside a variety of bit-wise operations. What's up with that?
I was reading a description of how SHA-256 worked and it included a description of the various ...
0
votes
1
answer
95
views
False positive error rate of truncated hash match
I’m having difficulty calculating the false positive error probability of matching a prefix of a hash that was truncated to m bits.
Say I have string S1 that produces a SHA256 hash H1. I then save the ...
1
vote
1
answer
422
views
How to generate a SNARK arithmetic circuit for SHA256?
I am using zkSNARK to prove knowledge of preimage for SHA256. However, the library used only supports field operations (such as add and multiply), and it compiles down to arithmetic circuits. Thus, ...
1
vote
0
answers
355
views
Creating a basic SHA256 hasher in Circom
I want to create a SHA256 hasher in Circom so I can validate that a person knows the pre-image of a SHA256 hash without revealing the pre-image. This is my current code but it doesn't work:
...
0
votes
1
answer
77
views
Double hashing scheme on not collision resistant hash
Given an hash H that is not collision resistant, for example 80-bit digest, if we use the following double hashing scheme: H(SHA2-256(x)).
Does this scheme increase the collision resistance?