1

I have one theoretic question. I know that mapping in Solidity is representation of hash tables, where we have hashed key and value stored to this key. Also arrays in EVM stores values in keccak256(index) slots in EVM memory.

Here my questions is:

  1. Can we say that array is hash table, but with keys as indexes 0,1,2..
  2. If yes, can we get collision if store different values in 0 index of array and in mapping by key 0?

1 Answer 1

0
  1. No, We cannot say that an array is a hash table. Arrays values are stored in contiguous storage slots while hash tables are not.
  2. No, we cannot get collision because the key 0 does not represent the 0 index. Index and key are totally different mechanisms.

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.