Package vash

Examples of vash.Seed


  }

  private Seed getSeedOrFail(String algo, byte[] salt, byte[] data) {
    vash.Seed s = null;
    try {
      s = new Seed(algo, salt, new ByteArrayInputStream(data));
    } catch(NoSuchAlgorithmException e) {
      System.err.println(e.toString());
      Assert.assertTrue(false);
    } catch(vash.InvalidSaltException e) {
      System.err.println(e.toString());
View Full Code Here


      0.7195341252586679,
      0.9581764259719031,
      0.4729503362008035,
      0.21240207599109995
    };
    Seed s = getSeedOrFail("1.1", null, "Vash".getBytes());
    for(double e : expected) {
      double a = s.nextDouble();
      Assert.assertEquals(e, a, 0.0001);
    }
  }
View Full Code Here

      0.9916866420769115,
      0.4520950836578299,
      0.5418716741986549,
      0.9171026475628842,
    };
    Seed s = getSeedOrFail("1", null, "Vash".getBytes());
    for(double e : expected) {
      double a = s.nextDouble();
      Assert.assertEquals(e, a, 0.0001);
    }
  }
View Full Code Here

      0.6835855007740271,
      0.8962415620254659,
      0.6706493194388035,
      0.690958033861017,
    };
    Seed s = getSeedOrFail("1-fast", null, "Vash".getBytes());
    for(double e : expected) {
      double a = s.nextDouble();
      Assert.assertEquals(e, a, 0.0001);
    }
  }
View Full Code Here

  @Test
  public void testSaltSeed1Fast() throws UnsupportedEncodingException {
    // "Iqe4HOR4El" is SXFlNEhPUjRFbA==
    byte[] seed1 = new byte[512/8];
    System.arraycopy("Iqe4HOR4El".getBytes("ASCII"), 0, seed1, 0, 10);
    Seed s1 = getSeedOrFail("1-fast", seed1, "Vash".getBytes("ASCII"));
   
    byte[] data = new byte[512/8 + 4];
    System.arraycopy("Iqe4HOR4El".getBytes("ASCII"), 0, data, 0, 10);
    System.arraycopy("Vash".getBytes("ASCII"), 0, data, 512/8, 4);
    Seed s2 = getSeedOrFail("1-fast", null, data);
   
    assertSameSeed(s1, s2);
  }
View Full Code Here

  @Test
  public void testSaltSeed1() throws UnsupportedEncodingException {
    // "Iqe4HOR4El" is SXFlNEhPUjRFbA==
    byte[] seed1 = new byte[512/8];
    System.arraycopy("Iqe4HOR4El".getBytes("ASCII"), 0, seed1, 0, 10);
    Seed s1 = getSeedOrFail("1", seed1, "Vash".getBytes("ASCII"));
   
    byte[] data = new byte[512/8 + 4];
    System.arraycopy("Iqe4HOR4El".getBytes("ASCII"), 0, data, 0, 10);
    System.arraycopy("Vash".getBytes("ASCII"), 0, data, 512/8, 4);
    Seed s2 = getSeedOrFail("1", null, data);
   
    assertSameSeed(s1, s2);
  }
View Full Code Here

TOP

Related Classes of vash.Seed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.