All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ionic.sdk.core.rng.RNG Maven / Gradle / Ivy

Go to download

The Ionic Java SDK provides an easy-to-use interface to the Ionic Platform.

There is a newer version: 2.9.0
Show newest version
package com.ionic.sdk.core.rng;

import java.security.SecureRandom;

/**
 * Utility functions relating to the JRE random number generator facility.
 */
public final class RNG {

    /**
     * Constructor.
     * http://checkstyle.sourceforge.net/config_design.html#FinalClass
     */
    private RNG() {
    }

    /**
     * Generate some random bytes, to be used in cryptographic operations.
     * 

* The empty argument constructor is used in preference to any particular implementation. This defers the choice * of random number generator to the system. *

* Once support for JRE 1.7 is dropped (JRE 1.8+), we may choose to migrate to use * * getInstanceStrong. * * @param bytes the byte array to be filled with random data * @return the parameter byte array, populated with secure random data * @see * SecureRandomImpl (oracle.com) * @see * Stack Overflow * @see * googleblog.com */ public static byte[] fill(final byte[] bytes) { new SecureRandom().nextBytes(bytes); return bytes; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy