I was wondering if it is possible to convert a string to a bytes32 or bytes in solidity like this, I want an input in string and require an equivalent bytes32 and bytes both.
input string = "0x8f54f1c2d0eb5771cd5bf67a6689fcd6eed9444d91a39e5ef32a9b4ae5ca14ff" output bytes32 = 0x8f54f1c2d0eb5771cd5bf67a6689fcd6eed9444d91a39e5ef32a9b4ae5ca14ff
input string = "0xd724b8592f7962a584cfedcacc2e308292f19f5245be8bdecb42354277d3a8674266a8d0b0f2fcdcdc42bc295e2bf6378da440ed7bcb022a154c8a28a825ddb301"
output bytes = 0xd724b8592f7962a584cfedcacc2e308292f19f5245be8bdecb42354277d3a8674266a8d0b0f2fcdcdc42bc295e2bf6378da440ed7bcb022a154c8a28a825ddb301
I have already looked into this link: How to convert a bytes32 to string but this is not working and returning different values than above.
bytes32
equivalence of a string would be the ASCII encoding of that string (not what you're describing in your question).bytes32
in the first place? That would keep the gas usage a lot lower.