是否有可能以某种方式从solidity数组类型获取uint256哈希,例如字符串或bytes32 []?
我想创建映射(uint256 =>地址),其中uint256是用户之前输入的某个字符串的哈希值。 感谢名单!
答案 0 :(得分:4)
You can use keccak256()
on any Solidity type (including strings and arrays) to generate a bytes32
hash. From there, you can either just use the bytes32
result as your key or cast it to a uint
.