In solidity, what is the best way to combine two addresses? I cannot find a consistent pattern for doing this with the address type.

Would the recommended pattern be to convert address to string, concatenate and generate a hash?

Here's the pattern I'm attempting to achieve.

sha3(address1 + address2)

1 Answer 1


The hashing functions in Solidity accept a variable number of arguments:

function hashTwoAddresses(address a, address b) pure returns (bytes32)
    return sha256(a, b);

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.