How can I convert a string
to a bytes32
?
Does anyone has a magic function or library which does it?
For example, this will works since as input I gave bytes32
. But it does not work with the characters greater than bytes32
.
tx_hash = a.transact().set("QmVoGzRDscx61k3RHHkLYaMFtxYZi3ps") // 32-bit char
function get() returns (string value) {
return list.get_head_data();
}
But if I need to give more character for example contains 48-bit string this won't work. How could I make this work?