summary refs log tree commit diff
path: root/Crypto/src/crypto/parameters/DsaValidationParameters.cs
blob: b9cdc4a79085d720699bcb96e61164fe3a9cb550 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;

using Org.BouncyCastle.Utilities;

namespace Org.BouncyCastle.Crypto.Parameters
{
    public class DsaValidationParameters
    {
        private readonly byte[] seed;
        private readonly int counter;

		public DsaValidationParameters(
            byte[]	seed,
            int		counter)
        {
			if (seed == null)
				throw new ArgumentNullException("seed");

			this.seed = (byte[]) seed.Clone();
            this.counter = counter;
        }

		public byte[] GetSeed()
        {
			return (byte[]) seed.Clone();
        }

		public int Counter
		{
			get { return counter; }
		}

		public override bool Equals(
            object obj)
        {
			if (obj == this)
				return true;

			DsaValidationParameters other = obj as DsaValidationParameters;

			if (other == null)
				return false;

			return Equals(other);
		}

		protected bool Equals(
			DsaValidationParameters other)
		{
			return counter == other.counter
				&& Arrays.AreEqual(seed, other.seed);
		}

		public override int GetHashCode()
        {
			return counter.GetHashCode() ^ Arrays.GetHashCode(seed);
		}
    }
}