0

Does SHA256 and/or Keccak considers current date time in hashing? I am curious how it avoids or reduces chances of collision. With so many wallets addresses getting created, I hope there is some mechanism in place.

2 Answers 2

1

No, but it's often accompanied with abi.encodePacked to consider timestamp, input, or other variables like in the example below:

uint256 key = uint256(keccak256(abi.encodePacked(block.timestamp, rand(), privateKey)));
2
  • is this used in wallet address creation as well? or are we talking about block (of blockchain) hashing here?
    – Ra Murd
    Commented Feb 3, 2022 at 16:04
  • It depends largely on the service, in the example of ethersproject on node.js the function generates the wallet address as follows: entropy = arrayify(hexDataSlice(keccak256(concat([ entropy, options.extraEntropy ])), 0, 16)); There's often also a collision check.
    – FudgyDRS
    Commented Feb 3, 2022 at 22:46
0

Not at all. Both Sha256 and Kecca256 give the exact same result for any given input at any time: yesterday, today, tomorrow. Their mechanism does not use any external variable to calculate their output, just the input number.

The collision in the wallet generators can be avoided using different generation vectors only and, as it as been clearly shown by researcher Ryan Castellucci in 2015, a lot of collisions can be generated using poor entropy inputs generators like brain wallets.

Good input, good output. Poor or repetitive input data, easy to crack output 😉

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.