Package org.gudy.azureus2.core3.util

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


    Map         localizationPaths,
    Collection       resource_bundles,
    int          initCapacity
  {
    this.initCapacity = initCapacity;
    messages = new LightHashMap(initCapacity);

    locale = main.getLocale();

      // use a somewhat decent initial capacity, proper calculation would require java 1.6
   
    addResourceMessages( main );
   
    synchronized (localizationPaths)
    {
      for (Iterator iter = localizationPaths.keySet().iterator(); iter.hasNext();){
        String localizationPath = (String) iter.next();
        ClassLoader classLoader = (ClassLoader) localizationPaths.get(localizationPath);

        addPluginBundle(localizationPath, classLoader);
      }
    }

    if (resource_bundles != null) {
      synchronized (resource_bundles)
      {
        for (Iterator itr = resource_bundles.iterator(); itr.hasNext();) {
          addResourceMessages((ResourceBundle)itr.next());
        }
      }

    }
   
    used_messages = new LightHashMap( messages.size());
   
    synchronized( bundle_map ){
     
      bundle_map.put( this, NULL_OBJECT );
     
View Full Code Here


  }
 
  protected Iterator
  getKeysLight()
  {
    Map m = new LightHashMap(loadMessages());
   
    return( m.keySet().iterator());
  }
View Full Code Here

      }
    }
   
    if ( clean_count > 5 ){
   
      Map  compact_um = new LightHashMap( used_messages.size() + 16 );
     
      compact_um.putAll( used_messages );
     
      used_messages = compact_um;
     
      return( false );
     
View Full Code Here

     
      Map  result;
     
      if ( scratch_file_is == null ){
       
        result = new LightHashMap();
       
      }else{
     
          // System.out.println( "read cache file " + scratch_file_name + " for " + this );

       
        Properties p = new Properties();
       
        InputStream  fis = scratch_file_is;
       
        try{
                 
          p.load( fis );
         
          fis.close();
         
          scratch_file_is = new FileInputStream( scratch_file_name );
         
          messages = new LightHashMap();
         
          messages.putAll( p );
         
          result = messages;
         
        }catch( Throwable e ){
         
          if ( fis != null ){
           
            try{
              fis.close();
             
            }catch( Throwable f ){
            }
          }
         
          Debug.out( "Failed to load message bundle scratch file", e );
         
          scratch_file_name.delete();
         
          scratch_file_is = null;
         
          result = new LightHashMap();
        }
      }
     
      if ( added_strings != null ){
       
View Full Code Here

      null_values = null;
    }
  }
 
  public void clearUsedMessagesMap(int initialCapacity) {
    used_messages = new LightHashMap(initialCapacity);
    if (null_values != null) {
      null_values = new ArrayList(0);
    }
  }
View Full Code Here

        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

             
             encoded = password;
             
            }else if ( encoding == org.gudy.azureus2.plugins.ui.config.PasswordParameter.ET_SHA1 ){
             
                  SHA1Hasher hasher = new SHA1Hasher();

                  encoded = hasher.calculateHash(password);
                 
            }else{
            
                // newly added, might as well go for UTF-8
             
View Full Code Here

  encode(
    byte[]    bytes )
  {
    if ( encoding_type == ET_SHA1 ){
     
          SHA1Hasher hasher = new SHA1Hasher();
         
          return( hasher.calculateHash( bytes ));
         
    }else if ( encoding_type == ET_MD5 ){
     
      try{
        return( MessageDigest.getInstance( "md5" ).digest( bytes ));
View Full Code Here

    if (data_in == null ){
     
      data_in = new byte[0];
    }
   
        SHA1Hasher hasher = new SHA1Hasher();
       
        return( hasher.calculateHash(data_in))
  }
View Full Code Here

  addSecretsSupport(
    byte[][]    secrets )
  {
    for (int i=0;i<secrets.length;i++){
     
      SHA1Hasher hasher = new SHA1Hasher();
        
         hasher.update( REQ2_IV );
         hasher.update( secrets[i] );
        
         byte[]  encoded = hasher.getDigest();
                         
      synchronized( global_shared_secrets ){
       
        global_shared_secrets.put( new HashWrapper( encoded ), secrets[i] );
      }
View Full Code Here

TOP

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

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.