Package java.security

Examples of java.security.SecureRandom.nextLong()


        // if true in the beginning, it should be so forever
        for (int i = 0; i < 1000; i++)
          {
            prng1.nextLong();
            prng2.nextLong();
          }

        a = prng1.nextLong();
        b = prng2.nextLong();
        harness.check (a == b);
View Full Code Here


            prng1.nextLong();
            prng2.nextLong();
          }

        a = prng1.nextLong();
        b = prng2.nextLong();
        harness.check (a == b);
      }
  }

  private SecureRandom getInstance ()
View Full Code Here

        SecureRandom secureRandom = new SecureRandom();

        synchronized(ContactMechServices.class) {
            while (true) {
                Long random = secureRandom.nextLong();
                verifyHash = HashCrypt.getDigestHash(Long.toString(random), "MD5");
                List<GenericValue> emailAddVerifications = null;
                try {
                    emailAddVerifications = delegator.findByAnd("EmailAddressVerification", UtilMisc.toMap("verifyHash", verifyHash));
                } catch (GenericEntityException e) {
View Full Code Here

    if (userService.isUserAdmin()) {
      resp.setDateHeader("Expires", System.currentTimeMillis());
      resp.setContentType("text/html");
      resp.setCharacterEncoding("UTF-8");
      SecureRandom r = new SecureRandom();
      long la = r.nextLong();
      String key = userService.getCurrentUser().getEmail() + la;
      SessionManager.recordKey(key);
      resp.getWriter().println("<html>");
      resp.getWriter().println("<head id='");
      resp.getWriter().println(key);
View Full Code Here

        SecureRandom secureRandom = new SecureRandom();

        synchronized(ContactMechServices.class) {
            while (true) {
                Long random = secureRandom.nextLong();
                verifyHash = HashCrypt.getDigestHash(Long.toString(random), "MD5");
                List<GenericValue> emailAddVerifications = null;
                try {
                    emailAddVerifications = delegator.findByAnd("EmailAddressVerification", UtilMisc.toMap("verifyHash", verifyHash));
                } catch (GenericEntityException e) {
View Full Code Here

        if (max <= 0) {
            // the range is too wide to fit in a positive long (larger than 2^63); as it covers
            // more than half the long range, we use directly a simple rejection method
            final SecureRandom rng = getSecRan();
            while (true) {
                final long r = rng.nextLong();
                if (r >= lower && r <= upper) {
                    return r;
                }
            }
        } else if (max < Integer.MAX_VALUE){
View Full Code Here

    byte[] keyData = new byte[blockSize / Byte.SIZE]; // initialized to 00h values, used later on
    final long[] tweak;
    try {
      SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG");
      rnd.nextBytes(keyData);
      tweak = new long[] { rnd.nextLong(), rnd.nextLong() };
    } catch (GeneralSecurityException e) {
      throw new RuntimeException(e);
    }

    ThreefishSecretKey sk = new ThreefishSecretKey(keyData);
View Full Code Here

    byte[] keyData = new byte[blockSize / Byte.SIZE]; // initialized to 00h values, used later on
    final long[] tweak;
    try {
      SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG");
      rnd.nextBytes(keyData);
      tweak = new long[] { rnd.nextLong(), rnd.nextLong() };
    } catch (GeneralSecurityException e) {
      throw new RuntimeException(e);
    }

    ThreefishSecretKey sk = new ThreefishSecretKey(keyData);
View Full Code Here

       
        SecureRandom secureRandom = new SecureRandom();

        synchronized(ContactMechServices.class) {
            while(true){
                Long random = secureRandom.nextLong();
                verifyHash = HashCrypt.getDigestHash(Long.toString(random), "MD5");
                List emailAddVerifications = null;
                try {
                    emailAddVerifications = delegator.findByAnd("EmailAddressVerification", UtilMisc.toMap("verifyHash", verifyHash));
                } catch (GenericEntityException e) {
View Full Code Here

    }
    masterRandom.setSeed(ByteBuffer.allocate(8).putLong(seed).array());

    // Can be used to check that rng is behaving as expected
    logger.debug("First number generated by master " + configKey +
                 ": " + masterRandom.nextLong());
    return masterRandom;
  }

  private void enqueueLoadWork(BlockingQueue<LoadChunk> chunk_q, long startid1,
      long maxid1, int nloaders, Random rng) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.