Examples of nextBytes()


Examples of java.util.concurrent.ThreadLocalRandom.nextBytes()

            {
                byte[] nextRun;
                if (runCount == 0 || random.nextDouble() < this.randomRatio)
                {
                    nextRun = new byte[random.nextInt(randomRunLength[0], randomRunLength[1])];
                    random.nextBytes(nextRun );
                    runs[runCount % runs.length] = nextRun;
                    runCount++;
                }
                else
                {
View Full Code Here

Examples of org.apache.shiro.crypto.RandomNumberGenerator.nextBytes()

    public static String issueRandomAPIToken() {
        // we need to see our tokens with a random value so the same one isn't generated
        // for the same user each time.
        RandomNumberGenerator rng = new SecureRandomNumberGenerator();
        Object randomNumber = rng.nextBytes();

        // we also use a user agent as a validation factor
        // so when we later validate the token, we also validate the user agent
        String secret = generateRandomString();
        String salt = secret.concat(randomNumber.toString());
View Full Code Here

Examples of org.apache.shiro.crypto.SecureRandomNumberGenerator.nextBytes()

        }

        if (generateSalt) {
            SecureRandomNumberGenerator generator = new SecureRandomNumberGenerator();
            int byteSize = generatedSaltSize / 8; //generatedSaltSize is in *bits* - convert to byte size:
            return generator.nextBytes(byteSize);
        }

        //no salt used:
        return null;
    }
View Full Code Here

Examples of org.bouncycastle.crypto.prng.DigestRandomGenerator.nextBytes()

        // seed PRNG with r'
        sr0.addSeedMaterial(rBytes);

        // generate random c2
        byte[] c2 = new byte[input.length];
        sr0.nextBytes(c2);

        // XOR with input
        for (int i = 0; i < input.length; i++)
        {
            c2[i] ^= input[i];
View Full Code Here

Examples of org.eclipse.jgit.junit.TestRng.nextBytes()

          b.write(v);
          expect[written++] = v;
        } else {
          final int len = Math
              .min(rng.nextInt() & 127, max - written);
          final byte[] tmp = rng.nextBytes(len);
          b.write(tmp, 0, len);
          System.arraycopy(tmp, 0, expect, written, len);
          written += len;
        }
        onebyte = !onebyte;
View Full Code Here

Examples of org.infinispan.lucene.testutils.RepeatableLongByteSequence.nextBytes()

            readBytes = new byte[(int) toRead];
            expectedBytes = new byte[(int) toRead];
         }
         int nextBytesToRead = (int) Math.min(toRead, arrayLengthToRead);

         bytesGenerator.nextBytes(expectedBytes);
         indexInput.readBytes(readBytes, 0, nextBytesToRead);

         assert Arrays.equals(expectedBytes, readBytes);

         toRead = toRead - nextBytesToRead;
View Full Code Here

Examples of se.grunka.fortuna.Fortuna.nextBytes()

        Fortuna fortuna = Fortuna.createInstance();
        System.err.println("Generating data...");
        OutputStream outputStream = new BufferedOutputStream(output);
        try {
            while (remainingBytes > 0) {
                fortuna.nextBytes(buffer);
                outputStream.write(buffer);
                remainingBytes -= buffer.length;
                System.err.print((100 * (dataSize - remainingBytes) / dataSize) "%\r");
            }
        } finally {
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.