SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Test
  2. void srEncryptionSeedTest() throws NoSuchAlgorithmException
  3. {
  4.     final long versionSalt = 1850498708034063014L;
  5.     final long customSalt  = -919666267416765972L;
  6.  
  7.     final SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
  8.     sr.setSeed(versionSalt);
  9.     final long l1 = sr.nextLong();
  10.     final long l2 = sr.nextLong();
  11.  
  12.     sr.setSeed(customSalt);
  13.     final long k1 = sr.nextLong();
  14.     final long k2 = sr.nextLong();
  15.  
  16.     // check l1 and l2
  17.     Assert.assertEquals(l1, 6338935000439666355L);
  18.     Assert.assertEquals(l2, -7355545655857008441L);
  19.  
  20.     // Seeding
  21.     // check k1 and k2
  22.     Assert.assertEquals(k1, -2226559466996804670L); //
  23.     Assert.assertEquals(k2, -3123855249705841778L);
  24. }
  25.      
  26. java.vendor -> Oracle Corporation // same goes on OpenJDK builds
  27. java.version -> 1.8.0_202-ea // same goes on 1.8.0_181
  28. java.vm.info -> mixed mode
  29. java.specification.version -> 1.8
  30. java.runtime.name -> Java(TM) SE Runtime Environment
  31.      
  32. java.vendor -> AdoptOpenJDK
  33. java.version -> 11.0.3
  34. java.vm.info -> mixed mode
  35. java.specification.version -> 11
  36. java.runtime.name -> OpenJDK Runtime Environment
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top