Questions tagged [hash]

A hash function is an algorithm that transfers data input of any size into a fixed size data which acts as a kind of "signature" for the data provided.

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

is it possible to use IPFS Hash to ensure file integrity?

My question is if i can use the IPFS Reference/Hash to ensure file integrity. In other words if i have a file can i use a specific Hashfunction to ensure that the generated Hash of that file is equal ...
0
votes
1answer
20 views

What is the best way to store a hexadecimal value in an array in Solidity?

I am attempting to store a hash (web3.sha3) into an array in a smart contract. What is the best way to do that?
1
vote
1answer
33 views

Am I hashing the data in the file itself, or just the reference?

I am attempting to create an app where I upload a file to a website and then I submit a hash of that file onto Ethereum. I am unsure whether I am hashing the actual file below or just the reference to ...
0
votes
1answer
57 views

How to hash multiple values including array keccak256 Solidity v5.0.x and web3 'Autodetection of array types is not supported.'

How can I receive the same hash in solidity and web3? Multiple values where one is a multi dimensional array. Solidity v0.5.x: pragma solidity 0.5.6; pragma experimental ABIEncoderV2; contract Hash{...
0
votes
3answers
59 views

web3.eth.sendSignedTransaction executed successfully but never any ETH transferred actually

as you see in below, i the raw transaction has been set by the gas simplify value, the returned value is an implemented transaction hashcode, but never assumed result by this transaction figure out ...
1
vote
1answer
39 views

Getting the transaction hash on function call

I am new to Solidity, Web3, and Ethereum. I am trying to build a web application through which users can upload a file to IPFS, then store the IPFS hash in the blockchain. I am using the React truffle ...
0
votes
0answers
13 views

Parity synced at not existing block 4839212

I have problem with parity, cant get synchronization in archive mode to end, anything, changing arguments, max-, min-, snapshot-peers, parity verisions do not help. I have blockchain in archive mode ...
0
votes
1answer
27 views

Hash bytes32 and uint32 in Soldiity 0.5.8

How can we efficiently calculate a hash value for a combination of bytes32 and integer value? Like in JavaScript "someString" + someInt. I tried: function fx(bytes32 _left, uint32 _right) public ...
1
vote
1answer
20 views

How to retrieve transaction hash value from the Promise object using web3js?

I'm trying to retrieve the transaction hash value after I call my smart contract method. My Promise object looks like below. returnPromise: Promise { "pending" } ​ <state>: "...
1
vote
1answer
28 views

How to encode function call in C

I understand web3 can be basically used for every existing task, however, is there anything we can use for C? My C program is communicating with the RPC server using the curl library, by posting JSON ...
0
votes
1answer
41 views

Costs/efficiency of locating stored data on Ethereum

Based on the answer to this question, storing IPFS hashes on Ethereum could be done in 3 ways: Store it as a string Store it as a struct Store it in event log Ordered from most expensive to least ...
1
vote
1answer
144 views

Ideal way to store hash on the ethereum blockchain

I would like to store a certificate on the blockchain. I only need to store its hash and if its been verified by both parties or not. Should I create a struct that is made up of bytes32 for the hash, ...
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?
0
votes
1answer
197 views

Block header hash calculation [duplicate]

What inputs go into the RLP and Keccak function to calculate the block header hash? I looked up the header struct. Which of those values are fed into the RLP, Keccak? Were nonce and mixed hash left ...
1
vote
1answer
87 views

block hash from block-header rlp [duplicate]

Given the RLP of a block header, how do i get the block hash? https://github.com/ethereum/go-ethereum/blob/master/core/types/block.go#L99 The above link says: Hash returns the block hash of the ...
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 ...
2
votes
1answer
39 views

How to create and compare a 32 byte hash of a string in solidity 0.5

I simply want to create a 32 byte hash of a string and compare equality to another one, but this is proving almost impossible for some reason. E.g: hash("a") == hash("b") My compiler throws errors ...
0
votes
1answer
32 views

How network hashrate is being calculated? [duplicate]

Hashrate The number of attempts that miner makes per second is known as the hash rate or hash power. Network's hashrate It is the most important data point in blockchain tech. ... Essentially, the ...
0
votes
1answer
35 views

i want to get data from the transaction hash i tried many codes at last i am getting boxes in the output

1) First, I got the input console.log(web3.eth.getTransaction('0x725fc75264726f409793164e336e7d5ed35df8d2be469a0cc1a3a8cc4756b9b9').then((i) => console.log(i) )); 2) I manually pasted the input ...
0
votes
1answer
58 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 ...
1
vote
1answer
32 views

For Recipient how do I store Sender's account address and Password of Recipient's own account in hashed from?

How to check following things using Solidity: Password matching (hash formed) if password matches then transfer take place
0
votes
0answers
52 views

Can I use an address value in such a hash function

I have a method which updates 3 mappings in my contract. To save data I use some items properties and message sender address, which allows easily to get users data. mapping(bytes32 => uint256) ...
2
votes
1answer
97 views

How do I use SoliditySha3 in Nethereum?

According to this, web3 should contain the function soliditySha3. It can take an object (JSON), serialize it, and use the result as input to Keccak256. According to the documentation, the arguments ...
1
vote
1answer
82 views

Hash functions soldity to python

In Solidity, I run the following code: function hashTest() public returns(bytes32,bytes32,bytes32) { bytes32 _solution = 0xbc756c25d68ea2f260ea5f15e1e1c734c019cbc014270dd386eacca4699f60f6; bytes32 v ...
1
vote
1answer
34 views

How will Proof of Stake affect blockhash generation

When (and if) Ethereum switches to proof of stake, how will the hash of blocks (most likely) be set?
1
vote
0answers
54 views

Does web3 soliditySha3 work with json object?

The above hash data is generated by web3 soliditySha3 with the objects below. It seems the function generates hashes as I wanted; each object has different hash value. But I am not sure if it's ...
0
votes
0answers
16 views

compare signed and unsigned hash [duplicate]

with ecrecover the signer's address can be extracted from a signed hash: ecrecover(signedHash, v, r, s) == address But I could not discover how to validate the hash. function validateHash(...
2
votes
0answers
70 views

Can we use Ethereum Swarm to store normal data other than blockchain or dapp data.

I want some basic data to be stored like name and city phone no etc.So just want to ask can I use ethereum swarm just to store file and make several node to create decentralized storage.
0
votes
2answers
392 views

Encrypt data using public key

I have three data fields in a form which will return a string. I would like to hash the value of these three strings and store it in the blockchain. However the data in these three strings is ...
1
vote
1answer
99 views

get same output as solidity SHA256 in JS

Is there a js function/library which gives same output as sha256 in solidity? I am saving a hash in a mapping and can access it via cli (truffle console) and see what the hash is but I would like to ...
0
votes
1answer
100 views

Is data inputted as a parameter for a smart contract function visible?

Let's say I have something like this: bytes32 person; function registerPerson(address _person) public { bytes32 x; x = sha256(abi.encodePacked(_person)); person = x; } For privacy reasons, ...
1
vote
1answer
38 views

Hashing header “offline” python

I am trying to prove that the TransactionsRoot and the ReceiptsRoot do belong to a specific block. So that I can verify without web3 that all the transactions and receipts actually belong to this ...
2
votes
1answer
31 views

How to get two points (x, y) from an encoded pubkey?

this gives a valid address from two points; address(uint256(keccak256(abi.encodePacked(point[0], point[1]))) & 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); but does that mean that if you are ...
1
vote
1answer
294 views

Creating hash of a struct in Solidity and JavaScript

I have created a message hash in JavaScript using: let message = { 'message': 'Receiver closing signature', 'sender': sender, 'balance': value }; message = web3.utils.toHex(...
0
votes
1answer
28 views

Creating an Ethereum id Hash

I'm trying to understand how to convert my transaction data into the id hash before signing the transaction. Let's say I have this data: transaction = { 'to': to_address, 'from': ...
0
votes
1answer
45 views

Checksum vs. Hash: Differences and Similarities ? [closed]

What are similarities and differences between a "checksum" algorithm and a "hash" function? Can they be used instead of each other? Or their usage are different? For example, for verifying the ...
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 ...
0
votes
1answer
199 views

messageHash hash function

In this example, by which algorithm is messageHash hashed by? web3.eth.accounts.sign("Hello, world!", '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') { message: 'Hello, world!', ...
4
votes
2answers
374 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 ...
3
votes
1answer
75 views

How does knowing the root hash of a past world state help me to revert to this world state?

In section 4.1 of the Ethereum yellow-paper (http://gavwood.com/Paper.pdf) the following is written: The world state (state), is a mapping between addresses (160-bit identifiers) and account ...
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 ...
8
votes
1answer
1k views

Why are Ethereum addresses hashes of public keys?

I understand how Ethereum addresses are generated. This thread has a great explanation: How are ethereum addresses generated? However, what this explanation is missing is why a hash is used. There ...
1
vote
0answers
68 views

are all bits of a keccak256 'uniformly distributed'? [closed]

If I have a truly random data source, and generate keccak256 hashes of the numbers of this source: N1 = keccak256(rnd1) N2 = keccak256(rnd2) N3 = keccak256(rnd3) ... are all 256 bits of the ...
1
vote
2answers
120 views

Is data stored in string form in smart contracts publicly readable?

As a beginner, I wrote the contract below for learning purposes, aiming to create a "Safe Messaging System": pragma solidity ^0.4.24; contract SafeMessage { string message; string password; string ...
0
votes
0answers
39 views

hash an array of structs

So what I am trying to do is create a keccak256 of an array of structs. pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; contract Test { struct test1 { address test; ...
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
163 views

Keccak256 collision in function’s prototype

I was reading the github version of the upcoming book Mastering Ethereum, where the author defines the function selector as The first 4 bytes of the Keccak256 hash of the function’s prototype. This ...
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 ...
3
votes
1answer
2k views

Convert hash function hex to bytes32

The output of hash function SHA256 is a hex string of size 64. For example: 3ed54831f488a22b28398de0c567a3b064b937f54f81739ae9bd545967f3abab I want to call the function of a smart contract with the ...
-2
votes
1answer
267 views

Why does keccak256() return bytes32 instead of uint256 in Solidity?

A hashing function outputs an integer that is 256 bits long... so why not store it as such?