i want send a series number or letter like "aa5glegd...." for 44 byte as uint256 to call method, and in that method change it to bytes, then convert bytes to uint256. but so much method on internet is for bytes32
1 Answer
Using assembly
function toBytes(uint256 x) returns (bytes b) {
b = new bytes(32);
assembly { mstore(add(b, 32), x) }
}
Found reference here- https://ethereum.stackexchange.com/questions/4170/how-to-convert-a-uint-to-bytes-in-solidity