Package java.math

Examples of java.math.BigInteger$UnsafeHolder


          random = new Random(2010);
        }
        random.nextBytes(randomBytes);
        randomBytes[6&= 0x0f/* clear version        */
        randomBytes[6|= 0x40/* set to version 4     */
        long msb = new BigInteger(randomBytes).longValue();
        random.nextBytes(randomBytes);
        randomBytes[0&= 0x3f/* clear variant        */
        randomBytes[0|= 0x80/* set to IETF variant  */
        long lsb = new BigInteger(randomBytes).longValue();
        record.setUUID("mmuid:"+new UUID(msb, lsb)); //$NON-NLS-1$
  }
View Full Code Here


            if(data.equals("N/A")) { //$NON-NLS-1$
                row.add(null);
            } else if(i==1 || i==4 || i== 5 || i==6 || i==7) {
                row.add(Double.valueOf(data));
            } else if(i==8) {
                row.add(new BigInteger(data));
            } else if(i==2) {
                if(!data.equals("0")){ //$NON-NLS-1$
                    try {
                        Date date = DATE_FORMAT.parse(data);
                        row.add(new java.sql.Date(date.getTime()));
View Full Code Here

  }


  public static String getEtag(byte[] bytes) {
    byte[] digest = md.digest(bytes);
    BigInteger number = new BigInteger(1, digest);
    return '0' + number.toString(16)// prepend a '0' to get a proper MD5 hash
  }
View Full Code Here

                    break;
                case DOUBLE:
                    this.sum = new Double(0);
                    break;
                case BIG_INTEGER:
                    this.sum = new BigInteger(String.valueOf(0));
                    break;
                case BIG_DECIMAL:
                    this.sum = new BigDecimal(0);
                    break;
            }
        }
           
        switch(this.accumulatorType) {       
            case LONG:
                this.sum = new Long(((Long)this.sum).longValue() + ((Number)input).longValue());
                break;
            case DOUBLE:
                this.sum = new Double(((Double)this.sum).doubleValue() + ((Number)input).doubleValue());
                break;
            case BIG_INTEGER:
                this.sum = ((BigInteger)this.sum).add( (BigInteger) input );
                break;
            case BIG_DECIMAL:
                if (input instanceof BigInteger) {
                    BigInteger bigIntegerInput = (BigInteger) input;
                    this.sum = ((BigDecimal)this.sum).add( new BigDecimal(bigIntegerInput) );
                } else {
                    this.sum = ((BigDecimal)this.sum).add( (BigDecimal) input );
                }
                break;   
View Full Code Here

      KeyFactory myKeyFac=KeyFactory.getInstance("DH");
      DHPublicKeySpec keySpec=new DHPublicKeySpec(f, p, g);
      PublicKey yourPubKey=myKeyFac.generatePublic(keySpec);
      myKeyAgree.doPhase(yourPubKey, true);
      byte[] mySharedSecret=myKeyAgree.generateSecret();
      K=new BigInteger(mySharedSecret);
      K_array=K.toByteArray();

//System.err.println("K.signum(): "+K.signum()+
//       " "+Integer.toHexString(mySharedSecret[0]&0xff)+
//       " "+Integer.toHexString(K_array[0]&0xff));
View Full Code Here

      K_array=mySharedSecret;
    }
    return K_array;
  }
  public void setP(byte[] p){ setP(new BigInteger(p)); }
View Full Code Here

      K_array=mySharedSecret;
    }
    return K_array;
  }
  public void setP(byte[] p){ setP(new BigInteger(p)); }
  public void setG(byte[] g){ setG(new BigInteger(g)); }
View Full Code Here

    }
    return K_array;
  }
  public void setP(byte[] p){ setP(new BigInteger(p)); }
  public void setG(byte[] g){ setG(new BigInteger(g)); }
  public void setF(byte[] f){ setF(new BigInteger(f)); }
View Full Code Here

    signature=java.security.Signature.getInstance("SHA1withDSA");
    keyFactory=KeyFactory.getInstance("DSA");
  }    
  public void setPubKey(byte[] y, byte[] p, byte[] q, byte[] g) throws Exception{
    DSAPublicKeySpec dsaPubKeySpec =
  new DSAPublicKeySpec(new BigInteger(y),
           new BigInteger(p),
           new BigInteger(q),
           new BigInteger(g));
    PublicKey pubKey=keyFactory.generatePublic(dsaPubKeySpec);
    signature.initVerify(pubKey);
  }
View Full Code Here

    PublicKey pubKey=keyFactory.generatePublic(dsaPubKeySpec);
    signature.initVerify(pubKey);
  }
  public void setPrvKey(byte[] x, byte[] p, byte[] q, byte[] g) throws Exception{
    DSAPrivateKeySpec dsaPrivKeySpec =
  new DSAPrivateKeySpec(new BigInteger(x),
            new BigInteger(p),
            new BigInteger(q),
            new BigInteger(g));
    PrivateKey prvKey = keyFactory.generatePrivate(dsaPrivKeySpec);
    signature.initSign(prvKey);
  }
View Full Code Here

TOP

Related Classes of java.math.BigInteger$UnsafeHolder

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.