Linked Questions
10 questions linked to/from How does Solidity's sha3 / keccak256 hash uints?
27
votes
2
answers
10k
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 ...
5
votes
3
answers
8k
views
Why do Python and Solidity keccak256 function gives different results?
I am working on implementing a smart contract application in which, on and off-chain calculations will exist. I will have to calculate the Hash Function of multiple integers with Python and Solidity. ...
4
votes
3
answers
4k
views
C# how to compute Keccak256 to match Solidity?
I have a simple Solidity function as below:
function testKeccak(uint8[] buffer) public pure returns (bytes32) {
return keccak256(abi.encodePacked(buffer));
}
Testing the keccak256 hash using ...
4
votes
1
answer
4k
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 ...
2
votes
1
answer
2k
views
From golang sha3 to solidity sha3
Trying to match "golang.org/x/crypto/sha3" lib
with solidity sha3() is giving me a hard time.
Its been discussed in here, but I somehow cant apply it in go.
How do I handle a big.Int type s.t i get ...
3
votes
2
answers
1k
views
Generate contract data hex for 'confirm' function on eth multisig wallet
I have an account on a hardware wallet that is an owner of a standard multsig wallet contract. I want to be able to approve a transaction that is originated from a different wallet. If I have access ...
5
votes
1
answer
2k
views
How can I do abi.encodePacked in Python or PHP?
Just concatenating strings doesn't work.
Keccak::hash(10 . $address, 256) is what I'm doing atm.
1
vote
1
answer
1k
views
How to generate consistent hash value with Solidity within Truffle?
I would like to generate hash value within Truffle using the web3.sha3() function and the hash value is required to be consistent with that one generated in Solidity. The basic example is sha3(uint256(...
1
vote
1
answer
1k
views
How to SHA3 strings and integers with Javascript
I want to hash two values(integer and string) in contract and get the same hash using these values at backend, but can't quite figure out what to do. Here are contract and JS code below.
pragma ...
0
votes
1
answer
450
views
What is the equivalent of solidity to perform ethereumjs-abi.soliditySHA3?
I am trying to tightly pack some typed data (array of structs or nested JSON) and generate SHA3 hash from it.
In JS, I can use ethereumjs-abi.soliditySHA3() method,
ethAbi.soliditySHA3(
['bytes32', '...