Questions tagged [keccak]
keccak is a cryptographic family which is used in ethereum and nowerdays provides the standards for sha-3
23
questions
97
votes
2answers
63k 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
10k 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
7k 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 ...
24
votes
1answer
8k 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)?
6
votes
4answers
2k views
keccak3 in SOLIDITY and in WEB3 different hashes for an address type field
How can I get the same resulting hash from Keccak-256 ()in solidity and web3.sha3() in web3?
IN solidity using keccak256( address ) and using web3.sha3 ( address ) gives different results.
In web3 ...
9
votes
2answers
745 views
What if two ether functions have the same signature?
It should not be hard to find collision.
There is only 4 294 967 296 possible signatures.
3
votes
1answer
574 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 ...
9
votes
2answers
3k views
5
votes
1answer
1k views
Distribution of KECCAK-256 hash values
Are values hashed using KECCAK - 256 uniformly distributed? If I use a KECCAK - 256 hash and then convert it to a number in a range 0 - N using the modulo operation, would the probability of obtaining ...
4
votes
1answer
149 views
Is pre 0.5.0 keccak256(a,b) equivalent to post 0.5.0 keccak256(abi.encodePacked(a,b))?
In pre 0.5.0 Solidity if you wanted to hash a some set of data you would do keccak(a, b, c). Post 0.5.0 keccak only takes 1 arg and it is suggested to use keccak(abi.encodePacked(a,b,c)) instead
But ...
0
votes
2answers
1k views
solidity ..which hashing algorithm to use?
I have tried using many hashing algorithms but there output in solidity doesn't match with the one given in online converters.
Here is my program:-
pragma solidity ^0.4.18;
contract C {
bytes32 ...
7
votes
1answer
3k views
Sign raw transaction offline with C++ on arduino
I'm exploring the IoT side of the EVM. I've programmed Arduinos and ESP8266s to interact with a Geth JSON RPC. I'm trying to be minimalistic and avoid NodeJS on the Geth JSON server side. Currently ...
8
votes
5answers
7k views
How to keccak256 multiple types in web3js to match Solidity keccak256?
if I keccak256(string1, address1) in Solidity, and then use web3.sha3(string1, address1) in web3.js, I get different results, even though when I do both with only string1 as a single argument, they ...
6
votes
1answer
903 views
Why doesn't my private key's public key generate the correct public address?
Private Key: 9ccbcabf23e271183dbed503b43277f4c6eee9ac918cd6cda75ebb73ceb35c7d
Corresponding Public Address: 0xa73Fb234B1773ed7b115D18A1f0a15579bA2C1e1 (check for yourself on MyCrypto, for example)
...
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 ...
4
votes
1answer
3k views
Different hash values for keccak256 functions?
In solidity i used the following command:
keccak256(firstName, lastName, studentId);
->0x157effbe0a2f53d887ad79b0dc3e9eb6084c3025ae0114a253b8f94f83c1462d
And, in NodeJS i used the following ...
4
votes
1answer
2k 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/...
3
votes
1answer
4k views
SOLIDITY: How to get a bytes32 keccak256 hash of an address and 2 uint256 variables
I would like to know how to get a bytes32 keccak256 hash of an address and 2 uint256 variables.
I want something that will look like this. But from the remix IDE errors, I need to make the the 3 ...
2
votes
2answers
564 views
Which sha3 output is the correct one?
Im trying to rewrite the all ethereum address creation and Tx creation in PHP and Im almost there. I have implemented a sha3 but now Im confused on if its giving me the correct output because it ...
2
votes
1answer
152 views
Understanding Low-Level Interface to Logs
This question is about Low-Level Interface to Logs, Solidity Documentation.
In given examples we are able to emit event normally:
pragma solidity ^0.4.0;
contract ClientReceipt {
event Deposit(
...
1
vote
1answer
302 views
How to Keccak 256 hash in front end JavaScript before passing it to my smart contract
I would like to build a simple JavaScript (JS) front end that checks if a field submitted is the pre-image of a keccak256 hash I already know in my smart contract. I currently use the following:
...
1
vote
1answer
919 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 ...
1
vote
5answers
570 views
Can I easily generate a public address which has no private key?
I might be wrong in some of the facts that I state here, so please correct me if necessary.
My understanding:
Private key - 256 bits
Public key - 256 bits
Public address - the last 160 bits of a ...