1b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampackage org.bouncycastle.crypto.params; 2b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 3c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstromimport org.bouncycastle.util.Arrays; 4c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 5b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallampublic class DHValidationParameters 6b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam{ 7b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam private byte[] seed; 8b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam private int counter; 9b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 10b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public DHValidationParameters( 11b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam byte[] seed, 12b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam int counter) 13b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 14b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam this.seed = seed; 15b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam this.counter = counter; 16b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 17b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 18c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom public int getCounter() 19c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 20c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return counter; 21c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 22c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 23c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom public byte[] getSeed() 24c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom { 25c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return seed; 26c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom } 27c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 28b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public boolean equals( 29b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam Object o) 30b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 31b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam if (!(o instanceof DHValidationParameters)) 32b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 33b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return false; 34b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 35b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 36b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam DHValidationParameters other = (DHValidationParameters)o; 37b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 38b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam if (other.counter != this.counter) 39b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 40b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam return false; 41b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 42b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam 43c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return Arrays.areEqual(this.seed, other.seed); 44b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 45c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom 46b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam public int hashCode() 47b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam { 48c37f4a04ef89e73a39a59f3c5a179af8c8ab5974Brian Carlstrom return counter ^ Arrays.hashCode(seed); 49b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam } 50b61a96e7ef1a78acf013bbf08fe537e5b5f129caPeter Hallam} 51