简体   繁体   English

如何使用 Solidity 密钥以最省气的方式通过 keccak256 散列两个字节 32 变量

[英]How to hash two bytes32 vars via keccak256 in the most gas-efficient way using Solidity keys

I know how to get hash by using keccak256() function and here is the sample answer.我知道如何使用 keccak256() 函数获取哈希,这是示例答案。 bytes32 c = keccak256(abi.encodePacked(a, b)); bytes32 c = keccak256(abi.encodePacked(a, b)); But is this the only way and best way???但这是唯一的方法,也是最好的方法???

But is this the only way and best way???但这是唯一的方法,也是最好的方法???

Yes, unless you want to cause some pain for yourself.是的,除非你想给自己造成一些痛苦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM