BraintreeEncryption.Library.BouncyCastle.Math.BigInteger.ToByteArrayUnsigned C# (CSharp) Method

ToByteArrayUnsigned() public method

public ToByteArrayUnsigned ( ) : byte[]
return byte[]
		public byte[] ToByteArrayUnsigned()
		{
			return ToByteArray(true);
		}

Usage Example

        public byte[] ConvertOutput(
			BigInteger result)
        {
            byte[] output = result.ToByteArrayUnsigned();

            if (forEncryption)
            {
                int outSize = GetOutputBlockSize();

                // TODO To avoid this, create version of BigInteger.ToByteArray that
                // writes to an existing array
                if (output.Length < outSize) // have ended up with less bytes than normal, lengthen
                {
                    byte[] tmp = new byte[outSize];
                    output.CopyTo(tmp, tmp.Length - output.Length);
                    output = tmp;
                }
            }

            return output;
        }