可直接构造,不用先转为串:
import std.digest.sha, std.bigint;
ubyte[32] hash = sha256Of(whatever);
auto t = BigInt(false, hash[]); // sign + magnitude
这样不行:
auto t = BigInt("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")
这样可以:
auto t = BigInt("0x" ~"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")