2
$\begingroup$

With blockchain support, it should finally become straightforward to convert string hashes to ByteArray, but I still can't figure out the canonical Wolfram way of doing it. What is the python equivalent of bytes.fromhex without StringPartition[...,2]?

$\endgroup$
  • 1
    $\begingroup$ The third argument of Hash can be "ByteArray" $\endgroup$ – ilian Mar 5 '18 at 20:41
  • $\begingroup$ @ilian Yes, but what if I've already got a string, similar to BlockChainData return values? $\endgroup$ – swish Mar 5 '18 at 21:58
  • 4
    $\begingroup$ IntegerDigits[FromDigits[str, 16], 256, StringLength[str]/2] would be the bytes, then wrap ByteArray $\endgroup$ – ilian Mar 5 '18 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.