本文整理汇总了C++中BigInteger::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ BigInteger::ToString方法的具体用法?C++ BigInteger::ToString怎么用?C++ BigInteger::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigInteger
的用法示例。
在下文中一共展示了BigInteger::ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
BigInteger p("6277101735386680763835789423207666416083908700390324961279", 10);
printf("p ---> %s\n", p.ToString().c_str());
BigInteger a("-3", 10);
printf("a ---> %s\n", a.ToString().c_str());
BigInteger b("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16);
printf("b ---> %s\n", b.ToString(16).c_str());
BigInteger n("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16);
printf("n ---> %s\n", n.ToString(16).c_str());
std::string xGs = "03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012";
std::vector<byte> xG = FromHexStringToByte(xGs);
printf("xG ---> %s\n", xGs.c_str());
std::string test = "test";
std::vector<unsigned char> bytes(test.begin(), test.end());
HashGOST hash(256);
std::vector<unsigned char> H = hash.GetHash(bytes);
std::string hres = "";
for (auto ttt : H) {
char tmp[2];
sprintf(tmp, "%02x", ttt);
hres += tmp;
}
printf("\n");
printf("HASH ---> %s\n", hres.c_str());
DSGost DS(p, a, b, n, xG);
BigInteger d = DS.GenPrivateKey(192);
printf("private key = %s\n", d.ToString(10).c_str());
ECPoint Q = DS.GenPublicKey(d);
printf("\n\npublic key\n");
printf("a ---> %s\n", Q.a.ToString().c_str());
printf("b ---> %s\n", Q.b.ToString().c_str());
printf("FieldChar ---> %s\n", Q.FieldChar.ToString().c_str());
printf("x ---> %s\n", Q.x.ToString().c_str());
printf("y ---> %s\n", Q.y.ToString().c_str());
std::string sign = DS.SingGen(H, d);
printf("\n\n\n");
printf("Sign --> %s\n", sign.c_str());
bool result = DS.SingVer(H, sign, Q);
if (result) {
printf("Correct\n");
} else {
printf("Wrong\n");
}
return 0;
}
示例2:
BigInteger::BigInteger(const BigInteger & input) :
BigInteger(input.ToString()) {
/* empty */
}