d的sha6转大整

原文
可直接构造,不用先转为串:

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")

文档

posted @ 2022-06-12 08:06  zjh6  阅读(16)  评论(0)    收藏  举报  来源