How do I implement BN_num_bytes() (and BN_num_bits() ) in C#?
问题 I'm porting this line from C++ to C#, and I'm not an experienced C++ programmer: unsigned int nSize = BN_num_bytes(this); In .NET I'm using System.Numerics.BigInteger BigInteger num = originalBigNumber; byte[] numAsBytes = num.ToByteArray(); uint compactBitsRepresentation = 0; uint size2 = (uint)numAsBytes.Length; I think there is a fundamental difference in how they operate internally, since the sources' unit tests' results don't match if the BigInt equals: 0 Any negative number 0x00123456 I