I have seen multiple questions to convert String to byte array, but what I want is to cast to byte[].
So that for instance, if I have a := "68656c6c6f20776f726c64"
, if I do []byte(a)
, it will convert each number into its hex value, but what I want is that it is directly interpreted as hex directly, so that I have []byte b = [68, 65, 6c, etc.]
Is there any other way different to iterating the string and every 2 characters appending them to the []byte
?