Package org.gudy.azureus2.core3.util

Examples of org.gudy.azureus2.core3.util.SHA1Simple


        else if( type.equalsIgnoreCase("string") ) {
          COConfigurationManager.setParameter( internal_name, setto );
          success = true;
        }
        else if( type.equalsIgnoreCase("password") ) {
          SHA1Hasher hasher = new SHA1Hasher();
         
          byte[] password = setto.getBytes();
         
          byte[] encoded;
         
          if(password.length > 0){
           
            encoded = hasher.calculateHash(password);
           
          }else{
           
            encoded = password;
          }
View Full Code Here


    throws MessageException
  {   
  final String  type     = "AEGEN:" + _type;
  final byte[]  type_bytes   = type.getBytes();
 
  final byte[][]  shared_secrets = new byte[][]{ new SHA1Simple().calculateHash( type_bytes ) };
   
  synchronized( message_handlers ){
   
    message_handlers.put( type, handler );
  }
View Full Code Here

              DHTPlugin.FLAG_MULTI_VALUE,
              new listenerMapper( listener, DistributedDatabaseEvent.ET_VALUE_WRITTEN, key, 0, false, false ));
         
          payload_length  = 1;
         
          current_key = new SHA1Simple().calculateHash( current_key );
        }
      }
     
      if ( payload_length > 1 ){
       
View Full Code Here

 
          if ( value[0] == 1 ){
           
              // continuation exists
           
            final  byte[]  next_key_bytes = new SHA1Simple().calculateHash( key_bytes );
           
            complete_disabled  = true;
   
            grabDHT().get
              next_key_bytes,
View Full Code Here

    if ( name == null ){
     
      throw( new DistributedDatabaseException( "name doesn't exist for '" + c.getName() + "'" ));
    }
     
    return( new HashWrapper(new SHA1Simple().calculateHash(name.getBytes())));
  }
View Full Code Here

  protected static long next_sha1_seed = 0;
 
  protected static byte[]
  getSHA1()
  {
    return( new SHA1Simple().calculateHash( ( "" + ( next_sha1_seed++ )).getBytes()));
  }
View Full Code Here

     
      return( deriveSingletonShortID( singleton_details ));
             
    }else{
   
      byte[]  hash = new SHA1Simple().calculateHash( public_key );

      byte[]  short_id = new byte[SIMPLE_ID_LENGTH];

      System.arraycopy( hash, 0, short_id, 0, SIMPLE_ID_LENGTH );
   
View Full Code Here

    deriveSingletonShortID(
      Map      singleton_details )
    {
      byte[]  short_id = new byte[SIMPLE_ID_LENGTH];

      byte[]   explicit_sid = new SHA1Simple().calculateHash((byte[])singleton_details.get( "key" ));
       
      System.arraycopy( explicit_sid, 0, short_id, 0, SIMPLE_ID_LENGTH );
     
      return( short_id );
    }
View Full Code Here

     
        // verify
     
      byte[] contents = BEncoder.encode( details );
     
      byte[] actual_hash = new SHA1Simple().calculateHash( contents );
 
      if ( !Arrays.equals( actual_hash, hash )){
       
          // backwards compat for pre-az_version
             
        Map details_copy = new HashMap( details );
       
        details_copy.remove( "az_version" );
       
        contents = BEncoder.encode( details_copy );
       
        actual_hash = new SHA1Simple().calculateHash( contents );
      }
     
      if ( !Arrays.equals( actual_hash, hash )){

        throw( new IOException( "Hash mismatch" ));
View Full Code Here

     
      updateDetails( subs, details );
     
      byte[] contents = BEncoder.encode( details );
         
      byte[] new_hash = new SHA1Simple().calculateHash( contents );
     
      byte[] old_hash  = (byte[])map.get( "hash" );
     
        // backward compat from before az_version was introduced
     
      if ( old_hash != null && !Arrays.equals( old_hash, new_hash )){
         
        Map details_copy = new HashMap( details );
       
        details_copy.remove( "az_version" );
       
        contents = BEncoder.encode( details_copy );
       
        new_hash = new SHA1Simple().calculateHash( contents );
      }
     
      if ( old_hash == null || !Arrays.equals( old_hash, new_hash )){
       
        byte[]  private_key = subs.getPrivateKey();
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.util.SHA1Simple

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.