1

I'm learning to use the keccak function on an online Solidity tutorial, and seeing that this function takes three inputs:

uint(keccak256(abi.encodePacked(now, msg.sender, randNonce)))

made me wonder how many inputs are allowed in.

1 Answer 1

0

Here abi.encodePacked no limit to number of input.It simply concatenated your input into once.

Exmaple: As per your function.

now = 1647410149
msg.sender = 0x6774A9dA5152d9c4BF9c468f0748d191Ac146720
randNonce = 15456

Assume your function input types : (uint32,address,uni256)

abi.encodePacked(now, msg.sender, randNonce) = 0x62317be56774A9dA5152d9c4BF9c468f0748d191Ac1467200000000000000000000000000000000000000000000000000000000000003c60

For more read about abi.encodePacked you can refer the solidity-docs.

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.