Diffie Hellman key agreement generates different key every time JAVA
I am experiencing a problem with Diffie Hellman implementation. I am using this code http://www.java2s.com/Tutorial/Java/0490__Security/DiffieHellmanKeyAgreement.htm It is actually an example from one book I am reading. But I can't understand why generateSecret() creates a different key for every KeyAgreement . I have noticed the function creates different keys even if I call it with the same KeyAgreement twice! If someone has something to suggest I will be really glad! Thanks for your time! MK. I think the part of the example private static BigInteger g512 = new BigInteger("1234567890", 16);