The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [sha3]

Regarding the use of the Secure Hash Algorithm SHA-3. Note that Ethereum and tools such as Solidity and web3.js uses Keccak-256.

Filter by
Sorted by
Tagged with
88
votes
2answers
50k 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 ...
24
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 ...
20
votes
2answers
6k views

Why aren't Solidity sha3 hashes not matching what other sha3 libraries produce?

Solidity has a function named sha3 and I tested it with an empty string input. It is not matching what other sha3 libraries produce. I see contracts written by others using the same sha3 function ...
3
votes
1answer
523 views

I need help with signatures

So, for my studies, I am supposed to interact with a contract function that has the following built in condition: if (ecrecover(_h, _v, _r, _s) == msg.sender && _h == sha3(this)) I am ...
21
votes
1answer
6k 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)?
3
votes
1answer
476 views

Ecrecover after eth_sign update with preamble

I've just discovered that with b59c839 geth is now pre-appending the string: *\x19Ethereum Signed Message:\n<length of message>* before signing the passed message. I've read here that to use ...
4
votes
2answers
1k 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 ...
1
vote
1answer
4k views

How can I generate a wallet in python?

Im trying to write a python script that can generate a new wallet for that user, but I need to be able to keep the private key. I followed this : Stack overflow answer And got these results: import ...
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
78 views

What should I do to get the same output using `sha3` by providing multiple input on nodejs?

I have following contract: pragma solidity ^0.4.0; contract Lottery { address public owner; bytes32 public hash; function Lottery() { owner = msg.sender; hash = sha3(10, owner)...
0
votes
1answer
160 views

How to get the same output using `sha3` by providing same address as input on nodejs?

I have following contract: pragma solidity ^0.4.0; contract Lottery { address public owner; bytes32 public hash; function Lottery() { owner = msg.sender; hash = sha3(owner); ...
5
votes
1answer
499 views

How to interact with the blinded auction contract from web3.js

My question is about the blind auction contract in the solidity examples. What is the right way to interact with the contract from web3.js? I tried this, but it does not give the right result. var ...
4
votes
1answer
844 views

Hash Test: How to produce hash output

Here is a basic hash test. I am trying to reproduce the output with: http://emn178.github.io/online-tools/sha3_256.html Is sha3-256 correct? The output for '1' as the value input is ...
0
votes
1answer
122 views

delegateContract address getting reset on delegatecall using geth console

I've deployed the following contracts on the rinkeby testnet. They are completely separate with different addresses: pragma solidity ^0.4.11; contract Backend { address public delegateContract; ...
0
votes
1answer
308 views

What is the gas cost of keccak256(“abc”)?

According to this answer, the gas cost of keccak256 is: 30 gas + 6 gas for each word (rounded up) for input data to a SHA3 Keccak-256 operation I'm assuming that the size of a word is 256 bits and ...