Questions tagged [hash-algorithm]

A hash algorithm is any algorithm that can be used to map data of arbitrary size to data of fixed size. The values returned by a hash function are called hash values, hash codes, hash sums, or simply hashes. In Ethereum, the algorithm used is Keccak 256.

Filter by
Sorted by
Tagged with
1
vote
2answers
60 views

Testing sha256(abi.encodePacked(_argument))

When trying to test a smart contract that uses sha256(abi.encodePacked(_myargument)) I don't get the same hash on truffle ! I tried both web3.utils.keccak256('_myargument') web3.utils.sha3('...
0
votes
0answers
26 views

Need to help in adding bigendian support for Keccak256.cpp

Need help in making the keccakf function based on endiness in https://github.com/ethereum/solidity/blob/develop/libdevcore/Keccak256.cpp. I have gone through similar functionality at https://github....
1
vote
1answer
25 views

Hashnot matching generated from solidity contract and web3js

I want to make hash same as generating by solidity contract from web3 or ether's js. In solidity contract hash generation by below : sha256(abi.encodePacked(no of parameters)). Kindly help for it. ...
0
votes
0answers
84 views

How does a message signed in Remix IDE?

What is signing method that is used in remix IDE and how is the hash value calculated from the message that is being signed?
5
votes
1answer
222 views

block-header hash verification

As part of a validation service I am working on, I need to be able to verify that the blockHeader hash was created correctly. Based on my understanding following are the steps to regenerate the header ...
0
votes
1answer
57 views

Match web3py hashing function to solidity hashing function

If I am using web3py to hash some data, like so, msgHash = w3.soliditySha3(['bytes32','bytes32'], [dataBytes, saltBytes]); What would be the correct way to hash inside of a Solidity contract and ...
0
votes
2answers
88 views

HMAC-x implementation for solidity

Is there any implementation of HMAC-SHA1 or HMAC-SHA256 or any other hashing algorithms for solidity? I found this but it's not working.
2
votes
1answer
480 views

I want to compare hash that I have passed in the argument of the function but keep getting this error

function compare(string memory input, uint _y) public returns (uint){ bytes32 hashedinput = keccak256(input); } Error: Invalid type for argument in function call. Invalid implicit conversion from ...
2
votes
1answer
36 views

Calculating a hash of a set of keys in Solidity

I have the following problem that I'm trying to think of an efficient solution for. Suppose I have a set of unordered keys (KEY_1, KEY_5, KEY_2, KEY_4), and I want to calculate a unique hash for this ...
3
votes
0answers
46 views

Why does a full client need to store the DAG?

The yellow paper says that miners and full clients must store the DAG dataset, but light clients can verify block headers by generating only a few necessary pages from the DAG. It makes sense to me ...
0
votes
1answer
80 views

Why is this random algorithm not good enough?

Many lotteries on Ethereum use random algorithms to determine a 'winner'. For instance, this function is bad because has some vulnerabilities (read here about some): function random() private view ...
0
votes
2answers
38 views

retrieving an original data from a hash: is it reliable?

Normally, one of the purposes of hashing a string (such as a transaction) is summarizing the data to save the size because of the space limitation. If this proposition is true, now assume we need to ...
4
votes
2answers
373 views

How is the keccak256(a, b) function implemented?

I need to understand how keccak256(a, b) is implemented and how it differs from keccak256(a || b). Is the content padded? I need this because I do not want to allow for vulnerabilities where a user ...
1
vote
2answers
90 views

Common use cases for hashing functions? [closed]

I'm developing my first dapp with solidity and I was wondering in which cases should I use hashing functions like keccak. I know how they work but it is not clear to me when should I use them and to ...
0
votes
1answer
30 views

Hash of address pair combination where order is irrelevant

I have a contract where I often set stuff for a combination of 2 addresses. Because the parameters addressA and addressB are interchangeable I currently save the information redundantly. Example: ...
0
votes
1answer
473 views

sha256() output

I used sha256() hash of a string and I got the following result 0x0de69f56365c10550d05e65ae8229dd0686f7894a807830daec8caa879731f4d for string Hello World2. Now I want to find out leading byte from the ...
2
votes
1answer
77 views

Hashing Algorithm - Multiple choices in Solidity

Is it possible to choose another SHA algorithm - say SHA256 - in Solidity? Anyone having issues with NIST compliance?
1
vote
0answers
99 views

Error deploying contract to my private network

I keep getting this "Error: The contract code couldn't be stored, please check your gas amount." message when I try to deploy my contract to the blockchain. I read that is a generic error so I'd like ...
1
vote
1answer
534 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 ...
2
votes
3answers
130 views

Are Ethereum Contracts Vulnerable to Hash Table Poisoning Attacks?

Does anybody know something about this? I know that in general terms we will say not, but looking on the internet I found that isn't sure the answer to the question: Can the EVM’s Internal ...
2
votes
2answers
358 views

Is a block number unique or does it change if the block becomes uncle? Does the transaction hash include a block hash as input?

Is a block number unique or do I need to save block hash to identify a block? Does transaction hash include a block hash as input?
1
vote
1answer
272 views

Help with error please (SHA256 returns 0x)

I'm just playing around with testrpc vs creating my own private blockchain and for some reason when I use testrpc and i use SHA256 in my smart contract to return a hash it gives me a proper one. But ...
1
vote
0answers
293 views

How can I create public-private key for a ERC20 wallet that using user's email address?

I am working on a side project that provides a wallet (Think Coinbase, Binance, etc) like interface to users where they will sign in using username and password. To be able to provide a clearer ...
0
votes
1answer
102 views

SHA3_512 library, convert the input and output to 512-bit bytes

The SHA3_512 library takes an input uint64[8] and outputs uint32[16]. To convert the input from 64 bytes and the output back to bytes, I wrote this, but it gives the wrong result. What are some ...
0
votes
1answer
31 views

Smartpools' sha3_512, is there a stand alone implementation?

Smart pool has implemented sha3_512 (contract), tough it looks like it is combined with EthHash. Is there a stand alone library just for the sha3_512 function?
-1
votes
2answers
357 views

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

Is it possible to do sha512 within a smart contract? Or, not?
0
votes
1answer
653 views

How Ethash works?

I've looked at the wiki in search of how the information about Ethash algorithm but i did not find the answer. Where can i find detailed information about it or can someone explain it?
0
votes
1answer
280 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
1answer
219 views

Hash a message in ethereum-js and check in Solidity

I'm trying to check an hashed message inside my Solidity smart contract. In JavaScript I hash the message as follows: util.sha3(Buffer.concat([ new Buffer(address1), new Buffer(bytes32), new ...
2
votes
1answer
200 views

How Merkle Tree obtain root node hash (example from 'Understanding the ethereum trie')?

I read Understanding the ethereum trie and try to do examples from that article. Now i am at ex1.py - first exaple. Look at code from that example: import sys sys.path.append('src') import trie, ...
10
votes
1answer
6k 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 ...
1
vote
1answer
583 views

What happens on hash collisions for, e.g., transactions, blocks, and contracts?

What happens on hash collisions for, e.g., transactions, blocks, and contracts? What happens if, say, two transactions hash to the same value? In this case, we say that a hash-collision occured. I'...
7
votes
1answer
1k views

Can a mined block have an odd number of transactions? If so, how does the Merkle root in that case?

Merkle Tree pairs transactions and hashes them and the process continues till we get to the root. But how would this pairing process work if the number of transactions were odd?
1
vote
1answer
135 views

Why geth use scrypt for key derivation?

As I understand scrypt was designed to be computationally intensive, so that it takes a relatively long time to compute. For what geth need this? And why it does not use, for example, SHA-256?
3
votes
1answer
6k views

Ethereum Transactions Take So long

It's first time when I tried to make an Ethereum wallet and to make a transfer. Compared to what I am used with other type of d.currency, this transaction seems to be taking forever. In almost 24h ...
0
votes
2answers
197 views

Smart Contract with web3j - Stored SHA hash returned is not the same as input

I have a contract that stores sha-256 hashes of documents (stored as bytes32). I also have a method to retrieve a hash that is mapped to a unique id for the document. However, when I retrieve and ...
2
votes
1answer
304 views

What is FNV and FNV function

When I was started to explore the ethash algorithm then I found this- FNV was used to provide a data aggregation function which is (i) non-associative, and (ii) easy to compute. A commutative and ...
2
votes
0answers
354 views

Mining UBIQ and DBIX using open-ethereum-pool

Open-Ethereum-Pool is configured to mine Ethereum; how do I configure it to mine UBIQ (which uses ethash) and DBIX coins? Thanks for answers
4
votes
2answers
567 views

Is there any project to calculate different hashes like md5, sha1 etc. in solidity?

I'm looking for solditiy-code to generate hashes of different hash-algorithms MD5 SHA1 SHA512 and more. Is there any project which implemented hash-algorithms in solidity? Is there someone out ...
2
votes
1answer
3k views

Is Ethereum's mining algorithm vulnerable to ASICBOOST?

Bitcoin's hashing algorithm uses a multi-step hashing function. Some miners have used a technique referred to as ASICBOOST to exploit this. I'm unclear on the specifics, but it has something to do ...
2
votes
1answer
303 views

Proof of Work validation

I am not too understanding this equation. Do any one know it? Especially what is m stand for since I cannot get it from the paper. Thanks
2
votes
1answer
44 views

Revealing played value

I'm writing a smart contract where participants are asked to submit a value (1 to 1000000) in the submission period, and then reveal what that value is in the revealing period. In order to hide it ...
1
vote
1answer
2k views

How to compare hash of two structures?

function checkOffers() public returns (bool){ uint256 a = sha256(offerFromProducer); uint256 b = sha256(offerFromConsumer); if(a == b){ return true; } return false; } 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/...
10
votes
1answer
6k 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 ...
10
votes
1answer
5k views

Ethash vs Equihash in terms of memory hardness?

Ethereum's Ethash was designed to be memory hard with the intention of making the mining process ASIC-resistant. Zcash's Equihash algorithm also promises the same. How do these two PoW systems compare ...
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; ...
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 ...
3
votes
2answers
350 views

Wallet download checksum

I am having trouble verifying the checksum of the newest Etherum wallet download. On the download site it is not specified which hash algorithm was used to generate the checksum so on my Mac I tried. ...
6
votes
1answer
129 views

Support in Ethereum for PoWs algos other than Ethash

I read that Ethereum uses Ethash as proof of work algorithm. But since there are other PoWs like NeoScrypt (used by Phoenixcoin), scryptJane (used by LEOcoin). Is it possible to use the above ...