Questions tagged [hash-algorithm]

A hash algorithm is any algorithm that can be used to map data of arbitrary size to data of fixed size. The values returned by a hash function are called hash values, hash codes, hash sums, or simply hashes. In Ethereum, the algorithm used is Keccak 256.

Filter by
Sorted by
Tagged with
94
votes
2answers
54k views

Which cryptographic hash function does Ethereum use?

Many sources refer to the use of the "SHA3" cryptographic hash function within Ethereum, but the Ethereum project began before the SHA3 standard was finalised, and there was some confusion/controversy ...
25
votes
3answers
9k views

How does Solidity's sha3 / keccak256 hash uints?

This is not a question about the issue with Ethereum using a non-standard sha3. I have found the right JS hashing library, and am able to get matching hashes in JS and Solidity on byte strings. What I ...
25
votes
2answers
16k views

When will the difficulty bomb make mining impossible?

I know the answer must be out there in the code already, but I couldn't figure out where exactly. Could someone do the maths for me: With block 200k the difficulty bomb started increasing the ...
22
votes
1answer
7k views

What is the cheapest hash function available in solidity?

AFAIK there are 3 hash functions to choose from in solidity (sha3, sha256, and ripemd). sha3 is native while the others use precompiled contracts. Which one of these is cheapest (in terms of gas)?
5
votes
1answer
490 views

block-header hash verification

As part of a validation service I am working on, I need to be able to verify that the blockHeader hash was created correctly. Based on my understanding following are the steps to regenerate the header ...
4
votes
2answers
759 views

Is there any project to calculate different hashes like md5, sha1 etc. in solidity?

I'm looking for solditiy-code to generate hashes of different hash-algorithms MD5 SHA1 SHA512 and more. Is there any project which implemented hash-algorithms in solidity? Is there someone out ...
7
votes
1answer
2k views

Can a mined block have an odd number of transactions? If so, how does the Merkle root in that case?

Merkle Tree pairs transactions and hashes them and the process continues till we get to the root. But how would this pairing process work if the number of transactions were odd?
4
votes
2answers
2k views

keccak256 Error Undeclared identifier in browser-solidity

I try to use sha3/keccak functions inside a Solidity contract, but I get a weird error: Untitled:5:13: Error: Undeclared identifier. bytes32 d=keccak256(0x616263); The contract : pragma ...
13
votes
1answer
5k views

arguments of the sha256 function in Solidity

In Solidity, I find that the sha256 function can be used like this a = sha256(uint b, string c, bool d, ......) (the arguments can be a combination of different types, and the other types can also be ...
4
votes
1answer
1k views

Getting Method ID “Keccak hash” in Python

I am trying to derive the Method ID, the Keccak (SHA-3) hash, in Python so that I may call the functions of my contracts once they are deployed as detailed in the ABI documentation: https://github.com/...
1
vote
1answer
942 views

How does Ethash work?

I've looked at the wiki in search of how the information about Ethash algorithm but I did not find the answer. Where can I find detailed information about it or can someone explain it?