I would use the System.Numerics.BigInteger class for this. The exact solution depends on the format in which you have this number: string, double, other.
If line ( s):
var bigInt = BigInteger.Parse(s);
var hexString = bigInt.ToString("x");
If double ( d):
var bigInt = new BigInteger(d);
var hexString = bigInt.ToString("x");
... etc.
phoog source
share