public static string PositiveValToHexString(this BigInteger x, bool lowerCase = true) { var bytes = x.PositiveValToBigEndianBytes(); string hexString = HexUtilities.BytesToHexString(bytes, lowerCase); if (hexString.StartsWith("0")) { return(hexString.Substring(1)); } else { return(hexString); } }
public static string PositiveValToHexString(this BigInteger x, int minWidth, bool lowerCase = true) { var minBytes = minWidth / 2 + minWidth % 2; var bytes = x.PositiveValToBigEndianBytes(); if (bytes.Length >= minBytes) { return(HexUtilities.BytesToHexString(bytes, lowerCase)); } else { byte[] expanded = new byte[minBytes]; Buffer.BlockCopy(bytes, 0, expanded, expanded.Length - bytes.Length, bytes.Length); string hexString = HexUtilities.BytesToHexString(expanded, lowerCase); if (hexString.Length > minWidth) { return(hexString.Substring(1)); } else { return(hexString); } } }
public string GetPublicKeyHexString(bool lowerCase = true) { return(HexUtilities.BytesToHexString(GetPublicKeyBytes(), lowerCase)); }