This gist contains the following Solidity code translated to Cairo:
uint256 x = 20 uint256 out = uint256(keccak256(abi.encode(x)))
It uses the
keccak256 implementation from starknet-l2-storage-verifier lib. The function deals with all the peculiarities of the necessary conversion (endianness, splitting of Uint256 to four 64-bit words and back again). There's also two helper python function to illustrate how to pass arguments in and how to deal with the result.