Package java.security

Examples of java.security.SecureRandom.nextInt()


                if (logger.isLoggable(MLevel.INFO))
                    logger.log(MLevel.INFO, "Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness", e);
                dos.write( srand.nextInt() );
            }
            dos.writeLong(System.currentTimeMillis());
            dos.write( srand.nextInt() );
           
            int remainder = baos.size() % 4; //if it wasn't a 4 byte inet address
            if (remainder > 0)
            {
                int pad = 4 - remainder;
View Full Code Here


    setTitle( "Page " + data.get( "count", Integer.class ) );
    parent.setLayout( new GridLayout( 1, false ) );
   
    // Create background color
    SecureRandom random = new SecureRandom();
    int red = random.nextInt( 255 );
    int green = random.nextInt( 255 );
    int blue = random.nextInt( 255 );
    Color background = new Color( parent.getDisplay(), red, green, blue );
    parent.setBackground( background );
   
View Full Code Here

    parent.setLayout( new GridLayout( 1, false ) );
   
    // Create background color
    SecureRandom random = new SecureRandom();
    int red = random.nextInt( 255 );
    int green = random.nextInt( 255 );
    int blue = random.nextInt( 255 );
    Color background = new Color( parent.getDisplay(), red, green, blue );
    parent.setBackground( background );
   
    // Create image label
View Full Code Here

   
    // Create background color
    SecureRandom random = new SecureRandom();
    int red = random.nextInt( 255 );
    int green = random.nextInt( 255 );
    int blue = random.nextInt( 255 );
    Color background = new Color( parent.getDisplay(), red, green, blue );
    parent.setBackground( background );
   
    // Create image label
    Label imageLabel = new Label( parent, SWT.NONE );
View Full Code Here

        if (boundary == null) {
            StringBuilder b = new StringBuilder();
            Random random = new SecureRandom();
           
            for (int i = 0; i < 16; i++) {
                b.append(BOUNDARY_CHARACTERS[random.nextInt(BOUNDARY_CHARACTERS.length)]);
            }
            boundary = String.format("----ClientFormBoundary%s", b.toString());
        }
        return boundary;
    }
View Full Code Here

        }
        else if ( HASH_METHOD_CRYPT.equalsIgnoreCase( hashMethod ) )
        {
            this.salt = new byte[2];
            SecureRandom sr = new SecureRandom();
            int i1 = sr.nextInt( 64 );
            int i2 = sr.nextInt( 64 );
            this.salt[0] = ( byte ) ( i1 < 12 ? ( i1 + '.' ) : i1 < 38 ? ( i1 + 'A' - 12 ) : ( i1 + 'a' - 38 ) );
            this.salt[1] = ( byte ) ( i2 < 12 ? ( i2 + '.' ) : i2 < 38 ? ( i2 + 'A' - 12 ) : ( i2 + 'a' - 38 ) );
        }
        else
View Full Code Here

        else if ( HASH_METHOD_CRYPT.equalsIgnoreCase( hashMethod ) )
        {
            this.salt = new byte[2];
            SecureRandom sr = new SecureRandom();
            int i1 = sr.nextInt( 64 );
            int i2 = sr.nextInt( 64 );
            this.salt[0] = ( byte ) ( i1 < 12 ? ( i1 + '.' ) : i1 < 38 ? ( i1 + 'A' - 12 ) : ( i1 + 'a' - 38 ) );
            this.salt[1] = ( byte ) ( i2 < 12 ? ( i2 + '.' ) : i2 < 38 ? ( i2 + 'A' - 12 ) : ( i2 + 'a' - 38 ) );
        }
        else
        {
View Full Code Here

            // Nothing works - use platform default
            result = new SecureRandom();
        }

        // Force seeding to take place
        result.nextInt();

        long t2 = System.currentTimeMillis();
        if ((t2 - t1) > 100)
        {
            if (log.isLoggable(Level.FINEST))
View Full Code Here

                break;

            case HASH_METHOD_CRYPT:
                salt = new byte[2];
                SecureRandom sr = new SecureRandom();
                int i1 = sr.nextInt( 64 );
                int i2 = sr.nextInt( 64 );

                salt[0] = ( byte ) ( i1 < 12 ? ( i1 + '.' ) : i1 < 38 ? ( i1 + 'A' - 12 ) : ( i1 + 'a' - 38 ) );
                salt[1] = ( byte ) ( i2 < 12 ? ( i2 + '.' ) : i2 < 38 ? ( i2 + 'A' - 12 ) : ( i2 + 'a' - 38 ) );
                break;
View Full Code Here

            case HASH_METHOD_CRYPT:
                salt = new byte[2];
                SecureRandom sr = new SecureRandom();
                int i1 = sr.nextInt( 64 );
                int i2 = sr.nextInt( 64 );

                salt[0] = ( byte ) ( i1 < 12 ? ( i1 + '.' ) : i1 < 38 ? ( i1 + 'A' - 12 ) : ( i1 + 'a' - 38 ) );
                salt[1] = ( byte ) ( i2 < 12 ? ( i2 + '.' ) : i2 < 38 ? ( i2 + 'A' - 12 ) : ( i2 + 'a' - 38 ) );
                break;
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.