Questions tagged [keccak]

keccak is a cryptographic family which is used in ethereum and nowerdays provides the standards for sha-3

Filter by
Sorted by
Tagged with
1
vote
1answer
79 views

Incorrect result for hash calculation

According to this link, [https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md][1]. The "signing data" becomes: ...
6
votes
1answer
931 views

Compare structs and arrays with keccak256 in order to save gas

Just working on a solidity code last day, I figured out that apart of comparing bytes, strings etc... The Keccak256 will be the perfect solution for comparing large arrays or big structs. Because as ...
4
votes
1answer
360 views

How to derive the storage key of mapping to an account?

I am trying to derive changes of account storage by mapping accounts (here, the accounts represent the key address in the ERC20 balances mapping mapping(address => uint256)) to their corresponding ...
1
vote
2answers
1k views

does keccak256 and sha3 reproduce the same hash ?

I have this solidity method: function hashData(bytes32 data) public constant returns (bytes32) { var hash = keccak256(data, msg.sender); return hash; } for a data = "0x707974686f6e62" and ...
1
vote
2answers
510 views

Solidity: How to verify Keccak-256 value?

I want to pass a Keccak-256 hashed value from the front-end, say a string "experiment". I store the value in Solidity, and, when passing the same value for the second time, a Solidity function needs ...
1
vote
1answer
461 views

how to hash an array of address?

I want to hash a given array of address (using keccak256) into a single variable byte32. for example: function hashOfArray( address [] list) public constant returns (byte32) { var hash = ... ...
0
votes
1answer
291 views

how can I return a hash value using keccak256?

I have this solidity function below. It is supposed to return the hash of a given data, but instead I get this: 0x function hashData (bytes32 data) public constant returns (bytes32) { var hash ...
3
votes
1answer
635 views

Ethereum address genеration and keccаk256

I'm trying to generate eth address on PHP. Having issue with keccak256. I'm using this class: https://github.com/kornrunner/php-keccak It works good, I checked many times on https://emn178.github.io/...
0
votes
1answer
314 views

Elliptic Key Crytography(ECC) for generating Private & Public Key

I want to generate Public-Private Key pair using ECC and then import them to Ethereum for creating an account through Geth. I am working on a Windows machine. What are the steps I should follow for ...
1
vote
1answer
129 views

Handling keccak collisions in decoupled storage pattern

The decoupled storage pattern (https://blog.colony.io/writing-upgradeable-contracts-in-solidity-6743f0eecc88) uses a hash function (keccak) to turn arbitrary length values into 32 byte keys for the ...
2
votes
1answer
128 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( ...
10
votes
1answer
157 views

Is it dangerous to name my function ccccvKygDv?

For those keeping track at home, the function hash of a function named ccccvKygDv() is 0xffffffff, the same as a null address. pragma solidity ^0.4.0; contract NullFunction { function ccccvKygDv()...
0
votes
2answers
620 views

Web3js and keccak different values

In solidity there is the keccak256 function which hashes its arguments. I use the keccak256 to compute and use the result to check if some entries exist in my array. I want to compute the same value ...
0
votes
1answer
466 views

sha512 in Solidity or assembly, does it exist? [duplicate]

Is it possible to do sha512 within a smart contract? Or, not?
1
vote
2answers
159 views

What is insecure about generating a random number with keccak256?

Just read that generating random a random number via keccak256 is insecure. What is insecure about it and what are the implications of insecurity?
6
votes
1answer
802 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) ...
1
vote
2answers
559 views

Why doesn't my verification of a signed message signature work in PHP?

I am attempting to verify a signed message in PHP. To be clear, I am not looking to interface with JSON-RPC or any external service, which I both a) know works and b) successfully verifies the ...
0
votes
1answer
699 views

Problem with sha3.keccak_256() update method in Python

I made a simple SHA3 Python script to generate Ethereum addresses and priv/pub keys. After that I sent some ETH to those addresses but then found out that priv keys do not correspond to the addresses ...
0
votes
1answer
2k views

How to generate keccak256(STRING,INTEGER) from Javascript?

In my solidity code I use bytes32 generated by keccak256("STRING_VALUE',INTEGER) to store values in the map. One of the sample values that get generated is ...
0
votes
1answer
208 views

Solidity keccak256(“contract.storage.initialised”)

Hi I was searching on upgradeable/upgradable contracts, then I found this Rocket Pool by David Rugendyke https://gist.github.com/darcius/6e8fa4faa6d9139f3950b6f1d9e96038 /// @dev Only allow access ...
0
votes
1answer
382 views

Keccak hash of null values, result in different hashes for different types

I was testing the hash value of null values for different types and I'm curious how it generates different results for different types. Here are the results. String = ...
1
vote
0answers
384 views

keccak256 returns 0x000000000000000

I am using the keccak256 hashing algo to retrieve a message for a signature however I am getting the return value above. Here is the code: function adminAuthorizedSwap(string price, string quantity, ...
2
votes
2answers
539 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 ...
1
vote
1answer
212 views

Correctly address Smart Contract storage address using web3js 1.0.0 library functions

A short while ago, I found a fantastic Medium article explaining Smart Contract storage. The examples in this article have helped me to understand how to read a Smart Contract's storage values from ...
2
votes
1answer
93 views

Fair, barely malleable CSPRNG that can still be deterministic?

Just for fun, I wanted to start off making a test contract that generates ERC-20 tokens based off of prime length when in binary representation. I decided to use Rabin-Miller for the primality test, ...
5
votes
1answer
2k views

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. ...
5
votes
1answer
907 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 ...
12
votes
1answer
8k views

Difference between keccak256 and sha3

I have been reviewing keccak256 implementation and sha3-256 that follows the FIPS standard. The sponge function is taking a while to set in, but I have noticed a difference in implementation : I ...
8
votes
5answers
6k 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 ...
7
votes
1answer
2k 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 ...
3
votes
1answer
765 views

Correct way to concatenate hashes for merkle tree

I'm using Richard Moore's ethers.js to create hashes of documents that will eventually be stored on the EVM. To create a merkle tree with many documents I'll need to hash together hashes. What's the ...
3
votes
1answer
678 views

Python keccak256 hash of uint8 array not matching solidity hash?

I have a function in a smart contract: function getNumberHash(uint8[] _numbers) constant public returns (bytes32) { return keccak256(_numbers); } When I pass [1,2,3,4,5] as the argument it ...
5
votes
2answers
2k views

Generate ethereum address in C#

I'm following the instructions here to generate a valid ethereum address from scratch. I'm using BouncyCastle's secp256k1 to do the privkey --> pubkey, but I don't know where to get a proper ...
0
votes
2answers
119 views

How to limit function access to certain frontend?

I've a function in my smartcontract, that pays out ETH to the sender. However it sgould be only callable from registered users on my website, regardless of their ETH-address. I already tried to send ...
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 ...
2
votes
0answers
569 views

On Ubuntu, I can't build sha3sum

I was following this article. When I saw that I've to have this keccak256-sum, I moved to this GitHub repo. But, when I am building it, it's giving below issue. $ make cc -Wall -Wextra -pedantic ...
1
vote
1answer
1k views

Save hash data with KECCAK-256 then reverse the process in PHP

I am saving data hashed with keccak-256 in Solidity and I am trying read that data with PHP, but cant seem to find any good solutions. I can get PHP to read off the data but I cant arrive at the same ...
8
votes
2answers
670 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.
2
votes
1answer
308 views

WEB3.SHA3 JSON CURL

I am trying to convert the string function name Double(int256) to hash using the Keccak-256 SHA3 algorithm using web3sha3 for curl. In geth I use the command as such web3.sha3('double(int256)') and ...
3
votes
1answer
524 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
1answer
995 views

How does keccak256 concatenate values inside a Solidity smart contract?

I'm developing a smart contract in Solidity in which I need to evaluate the hash of two concatenated bytes32. I don't have to concatenate the bytes32 since the sha3 function supports more than one ...
2
votes
1answer
4k views

Does Ethereum use Ethash or KECCAK-256 (an alias to SHA3) as hash function?

Ethdoccs says that the PoW algorithm Ethereum is using is Ethash. While I was searching around for information about Ethash, I ran across this post, which indicates KECCAK is the one. So what is ...
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/...
12
votes
1answer
8k views

How does the Keccak256 hash function work?

As the Ethereum platform relies on the Keccak256 hash algorithm, I'd like to get a better understanding of it. My rough understanding is something like this: a function accepting a finite set of ...
3
votes
3answers
3k views

Keccak256(parameter) How to pass a string to be hashed?

I'm trying to do something that in theory is very simple: I want to pass a string like "hello" to a function and then compute the sha3/keccak256 hash. I think the problem is that if the parameter is a ...
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 ...
1
vote
2answers
865 views

In Solidity, can i store the value of keccak_256 in bytes32?

var uniqueIdentifier = keccak_256(firstName+LastName+studentId); This line returns me a value and can i store that value in bytes32 in solidity?
0
votes
1answer
211 views

Solidity's Keccak256 function requires mining? [closed]

I have used keccak256 and passed 3 parameters. Does keccak256 require mining?
2
votes
1answer
5k views

How to use keccak256 in Solidity?

I have created a Student registration form and taking input as firstName, lastName and studentRegId. Something like this: contract Unique { string fn; string ln; bytes20 val; bytes32 sId; ...
7
votes
1answer
525 views

How to install and test Viper programming language?

Viper is a new functional, strongly typed, bounds/overflow-checking, fixed-point-decimal python syntax-based HLL. The repository does not inlcude any documentation yet. I built and installed ...