繁体   English   中英

mscorlib.dll中发生了'System.FormatException'类型的未处理异常

[英]An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll

using Org.BouncyCastle.Math;
    string p = "E7A69EBDF105F2A6BBDEAD7E798F76A209AD73FB466431E2E7352ED262F8C558F10BEFEA977DE9E21DCEE9B04D245F300ECCBBA03E72630556D011023F9E857F";
    BigInteger P= new BigInteger(p);

抛出异常

System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffe
r& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo in
fo)
   at System.Int32.Parse(String s, NumberStyles style)
   at Org.BouncyCastle.Math.BigInteger..ctor(String str, Int32 radix)
   at Org.BouncyCastle.Math.BigInteger..ctor(String value)

怎么了

如果您的数字字符串为十六进制,则需要在构造函数中将基数指定为:

BigInteger P = new BigInteger(p,16); 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM