예제 #1
0
		 public static uint160 operator ++(uint160 a)
		{
			var ret = new uint160(a);
			return a + new uint160(1);
		}
예제 #2
0
		public ScriptId(uint160 value)
			: base(value)
		{

		}
예제 #3
0
		public static uint160 operator |(uint160 a, uint160 b)
		{
			var n = new uint160(a);
			for(int i = 0 ; i < WIDTH ; i++)
				n.pn[i] |= b.pn[i];
			return n;
		}
예제 #4
0
		public static uint160 operator >>(uint160 a, int shift)
		{
			var result = new uint160();
			int k = shift / 32;
			shift = shift % 32;
			for(int i = 0 ; i < WIDTH ; i++)
			{
				if(i - k - 1 >= 0 && shift != 0)
					result.pn[i - k - 1] |= (a.pn[i] << (32 - shift));
				if(i - k >= 0)
					result.pn[i - k] |= (a.pn[i] >> shift);
			}
			return result;
		}
예제 #5
0
		private static int Comparison(uint160 a, uint160 b)
		{
			if (a.pn4 < b.pn4)
				return -1;
			if (a.pn4 > b.pn4)
				return 1;
			if (a.pn3 < b.pn3)
				return -1;
			if (a.pn3 > b.pn3)
				return 1;
			if (a.pn2 < b.pn2)
				return -1;
			if (a.pn2 > b.pn2)
				return 1;
			if (a.pn1 < b.pn1)
				return -1;
			if (a.pn1 > b.pn1)
				return 1;
			if (a.pn0 < b.pn0)
				return -1;
			if (a.pn0 > b.pn0)
				return 1;
			return 0;
		}
예제 #6
0
		public static uint160 operator ^(uint160 a, uint160 b)
		{
			var c = new uint160();
			c.pn = new uint[a.pn.Length];
			for(int i = 0 ; i < c.pn.Length ; i++)
			{
				c.pn[i] = a.pn[i] ^ b.pn[i];
			}
			return c;
		}
예제 #7
0
파일: KeyId.cs 프로젝트: zzms/NBitcoin
 public WitKeyId(uint160 value)
     : base(value.ToBytes())
 {
 }
예제 #8
0
		public uint160(uint160 b)
		{
			pn0 = b.pn0;
			pn1 = b.pn1;
			pn2 = b.pn2;
			pn3 = b.pn3;
			pn4 = b.pn4;
		}
예제 #9
0
		public static uint160 Parse(string hex)
		{
			var ret = new uint160();
			ret.SetHex(hex);
			return ret;
		}
예제 #10
0
		public static bool TryParse(string hex, out uint160 result)
		{
			if(hex == null)
				throw new ArgumentNullException("hex");
			result = null;
			if(hex.Length != WIDTH_BYTE * 2)
				return false;
			if(!((HexEncoder)Encoders.Hex).IsValid(hex))
				return false;
			var ret = new uint160();
			ret.SetHex(hex);
			result = ret;
			return true;
		}
예제 #11
0
		public uint160(uint160 b)
		{
			for(int i = 0 ; i < WIDTH ; i++)
				pn[i] = b.pn[i];
		}
예제 #12
0
        public static uint160 operator ++(uint160 a)
        {
            var ret = new uint160(a);

            return(a + new uint160(1));
        }
예제 #13
0
 public TxDestination(uint160 value)
     : this(value.ToBytes())
 {
 }
예제 #14
0
 public ScriptId(uint160 value)
     : base(value)
 {
 }
예제 #15
0
파일: KeyId.cs 프로젝트: zzms/NBitcoin
 public ScriptId(uint160 value)
     : base(value.ToBytes())
 {
 }
예제 #16
0
			public void ReadWrite(BitcoinStream stream)
			{
				if(stream.Serializing)
				{
					var b = Value.ToBytes();
					stream.ReadWrite(ref b);
				}
				else
				{
					byte[] b = new byte[WIDTH_BYTE];
					stream.ReadWrite(ref b);
					_Value = new uint160(b);
				}
			}
예제 #17
0
파일: KeyId.cs 프로젝트: n1rvana/NBitcoin
		public WitKeyId(uint160 value)
			: base(value.ToBytes())
		{

		}
예제 #18
0
		public static bool TryParse(string hex, out uint160 result)
		{
			if(hex == null)
				throw new ArgumentNullException("hex");
			if (hex.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
				hex = hex.Substring(2);
			result = null;
			if(hex.Length != WIDTH_BYTE * 2)
				return false;
			if(!((HexEncoder)Encoders.Hex).IsValid(hex))
				return false;			
			result = new uint160(hex);
			return true;
		}
예제 #19
0
파일: KeyId.cs 프로젝트: n1rvana/NBitcoin
		public ScriptId(uint160 value)
			: base(value.ToBytes())
		{

		}
예제 #20
0
		private static int Comparison(uint160 a, uint160 b)
		{
			 for (int i = WIDTH-1; i >= 0; i--)
			{
				if (a.pn[i] < b.pn[i])
					return -1;
				else if (a.pn[i] > b.pn[i])
					return 1;
			}
			return 0;
		}
예제 #21
0
 public MutableUint160()
 {
     _Value = uint160.Zero;
 }
예제 #22
0
	   public static uint160 operator+(uint160 a, uint160 b)
    {
		var result = new uint160();
        ulong carry = 0;
        for (int i = 0; i < WIDTH; i++)
        {
            ulong n = carry + a.pn[i] + b.pn[i];
            result.pn[i] = (uint)(n & 0xffffffff);
            carry = n >> 32;
        }
        return result;
    }
예제 #23
0
 public MutableUint160()
 {
     this._Value = Zero;
 }
예제 #24
0
		public static uint160 operator <<(uint160 a, int shift)
		{
			var result = new uint160();
			int k = shift / 32;
			shift = shift % 32;
			for(int i = 0 ; i < WIDTH ; i++)
			{
				if(i + k + 1 < WIDTH && shift != 0)
					result.pn[i + k + 1] |= (a.pn[i] >> (32 - shift));
				if(i + k < WIDTH)
					result.pn[i + k] |= (a.pn[i] << shift);
			}
			return result;
		}
예제 #25
0
 public MutableUint160(uint160 value)
 {
     this._Value = value;
 }
예제 #26
0
		public static uint160 operator -(uint160 a)
		{
			var b = new uint160();
			for(int i = 0 ; i < b.pn.Length ; i++)
			{
				b.pn[i] = ~a.pn[i];
			}
			b++;
			return b;
		}
예제 #27
0
			public MutableUint160()
			{
				_Value = uint160.Zero;
			}
예제 #28
0
		public KeyId(uint160 value)
			: base(value)
		{

		}
예제 #29
0
			public MutableUint160(uint160 value)
			{
				_Value = value;
			}
예제 #30
0
		public TxDestination(uint160 value)
			: this(value.ToBytes())
		{
		}
예제 #31
0
 public KeyId(uint160 value)
     : base(value)
 {
 }