Search code examples
c#bouncycastlebiginteger

equivalent to BN_hex2bn


is there any equivalent to BN_hex2bn in C# , I wanna make BigInteger from hex string!

am using BouncyCastel to create BigIntegers

BigInteger N = new BigInteger("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", 16);

now when I compare the value of BouncyCastel's BigInteger to OpenSSL's BN_hex2bn it gives me different values

openssl = 894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C8287

BouncyCastel = 62100066509156017342069496140902949863249758336000796928566441170293728648119 

I don't understand what is causing it to has a different value , or how can I get the same value as OpenSSL !!!?


Solution

  • 0894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7
    

    is the hexadecimal representation of the decimal number:

    62100066509156017342069496140902949863249758336000796928566441170293728648119
    

    This means that both numbers are equal. You're just looking at them in differens bases.