Org.BouncyCastle.Math.BigInteger.ToByteArray C# (CSharp) Method

ToByteArray() public method

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

Same methods

BigInteger::ToByteArray ( bool unsigned ) : byte[]

Usage Example

        public static byte[] IntegerToBytes(
            BigInteger	s,
            int			qLength)
        {
            byte[] bytes = s.ToByteArray();

            if (qLength < bytes.Length)
            {
                byte[] tmp = new byte[qLength];

                Array.Copy(bytes, bytes.Length - tmp.Length, tmp, 0, tmp.Length);

                return tmp;
            }

            if (qLength > bytes.Length)
            {
                byte[] tmp = new byte[qLength];

                Array.Copy(bytes, 0, tmp, tmp.Length - bytes.Length, bytes.Length);

                return tmp;
            }

            return bytes;
        }
All Usage Examples Of Org.BouncyCastle.Math.BigInteger::ToByteArray