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
2
votes
2answers
420 views

Where can I see the output of Solidity's sha3 function?

I have written the below code and it runs perfectly. After mining and passing the values along with certain gas value, i get transaction hash as output on the geth console. Now i want to know the ...
2
votes
1answer
4k 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
513 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 ...
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
2answers
139 views

What do the parameter in sha3() in Proof of Work implementation of Ethereum mean

sha3(nonce, currentChallenge, block.blockhash(block.number-1)) In this line I get it that blockhash is a random number, but why are we taking it from the previous block, any hard and fast rule here ? ...
4
votes
2answers
701 views

How to compute SHA-3 of an array of numbers in Javascript?

The documentation says that sha3 calculates the hash of the tightly packed arguments. Numbers seem to be converted to ASCII chars. Consider using sha3(values) in Solidity with the type int8[3] values,...
4
votes
1answer
377 views

XOR bytes32 (from web3.sha3) in Javascript

How can I perform bitwise operations with a bytes32 object in Javascript? This might seem like a general Javascript question but since this is quite common practice to obfuscate input values in a ...
7
votes
1answer
588 views

Calculating difficulty and verifying a hash as a solution

I have a scheme right now where individuals are committing to a contract a solution to a problem similar to Bitcoin's proof-of-work protocol. Here's the basic flow...the contract calculates a seed ...
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)?
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 ...
6
votes
3answers
461 views

Is it possible to verify Ethash PoW in a contract?

Reading on EtHash, I was thinking if it is possible to verify the current Ethereum Proof Of Work by a smart contract. There is an instruction SHA3, which computes 256-bit hash, but EtHash uses 512-bit ...
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 ...
2
votes
0answers
150 views

Blind Auction: Reveal>>>How to successfully fill data fields [duplicate]

http://solidity.readthedocs.org/en/latest/solidity-by-example.html#id2 Not confident in how to "blind" a secret and reveal it. Using http://emn178.github.io/online-tools/keccak_256.html for the hash....
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 ...
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 ...
9
votes
1answer
433 views

Are there any plans to switch Ethereum's primary hash algorithm from Keccak-256 to SHA3?

The Ethereum project was started before the SHA3 standard was finalised, and currently uses an earlier version of Keccak-256 which does not precisely match the FIPS-202 standard for SHA. Are there ...
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 ...