Erase the password byte array by setting its elements to zero.
For security reason, all password byte array should be erased before the references to it is dropped.

@param pwdBytes The password byte array to be erased.
424151
@Trivial
    public static void erasePassword(@Sensitive byte[] pwdBytes) {
        if (pwdBytes != null) {
            for (int i = 0; i < pwdBytes.length; i++) {
                pwdBytes[i] = 0x00;
            }
        }

    }
1303993
public void setCredentials(String userid, String password) {
        Map<String, String> data = new HashMap<String, String>();
        data.put("userid", userid);
        data.put("password", password);
        RemotingHeader header = new RemotingHeader(RemotingHeader.CREDENTIALS, true, data);
        headers.put(RemotingHeader.CREDENTIALS, header);
    }
545298
function _clearBuffers()
    {
        $this->enbuffer = $this->debuffer = array('ciphertext' => '', 'xor' => '', 'pos' => 0, 'enmcrypt_init' => true);

        // mcrypt's handling of invalid's $iv:
        // $this->encryptIV = $this->decryptIV = strlen($this->iv) == $this->block_size ? $this->iv : str_repeat("\0", $this->block_size);
        $this->encryptIV = $this->decryptIV = str_pad(substr($this->iv, 0, $this->block_size), $this->block_size, "\0");

        if (!$this->skip_key_adjustment) {
            $this->key = str_pad(substr($this->key, 0, $this->key_length), $this->key_length, "\0");
        }
    }
177757
private function resetPasswordEncryption()
    {
        $defaultEncryption = Security::config()->get('password_encryption_algorithm');
        if ($this->owner->PasswordEncryption != $defaultEncryption) {
            DB::prepared_query(
                'UPDATE "Member" SET "PasswordEncryption" = ? WHERE ID = ?',
                [$defaultEncryption, $this->owner->ID]
            );
        }
    }
186959
@Override
    public void write(byte[] b, int off, int len) throws IOException
    {
        int wbytes = len;
        int offset = off;
        
        while( wbytes > 0 )
        {
            if ( buf.position() >= buf.capacity() )
            {
                flush();
            }
            
            int length = Math.min( wbytes, buf.limit() - buf.position() );
            
            buf.put(b, offset, length);
            
            offset += length;
            wbytes -= length;
        }
    }
743968
@Override
  public synchronized void reset() {
    finish = false;
    finished = false;
    uncompressedDirectBuf.clear();
    uncompressedDirectBufLen = 0;
    compressedDirectBuf.clear();
    compressedDirectBuf.limit(0);
    userBufOff = userBufLen = 0;
    bytesRead = bytesWritten = 0L;
  }
531782
static void clear(byte[][] blocks, int off, int len) {
    // this is significantly faster than looping or Arrays.fill (which loops), particularly when
    // the length of the slice to be cleared is <= to ARRAY_LEN (in that case, it's faster by a
    // factor of 2)
    int remaining = len;
    while (remaining > ARRAY_LEN) {
      System.arraycopy(NULL_ARRAY, 0, blocks, off, ARRAY_LEN);
      off += ARRAY_LEN;
      remaining -= ARRAY_LEN;
    }

    System.arraycopy(NULL_ARRAY, 0, blocks, off, remaining);
  }
467870
public void setRemoveSecurityGroupIds(java.util.Collection<String> removeSecurityGroupIds) {
        if (removeSecurityGroupIds == null) {
            this.removeSecurityGroupIds = null;
            return;
        }

        this.removeSecurityGroupIds = new com.amazonaws.internal.SdkInternalList<String>(removeSecurityGroupIds);
    }
787666
public void reset() {
        super.reset();

        H1 = 0x67452301;
        H2 = 0xefcdab89;
        H3 = 0x98badcfe;
        H4 = 0x10325476;

        xOff = 0;

        for (int i = 0; i != X.length; i++) {
            X[i] = 0;
        }
    }
696092
@Override
    public void setBytes(int parameterIndex, byte[] x) throws SQLException
    {
        checkParameterBounds(parameterIndex);
        this.parameters[parameterIndex-1] = x;
    }
471137
public void writeBytes(byte[] buffer)
        throws IOException
    {
        if (buffer == null)
            os.write('N');
        else
            writeBytes(buffer, 0, buffer.length);
    }
793355
public void setCurrentPasswordHashPassword(String newPassword) {
        this.passwordSalt = UUID.randomUUID().toString();

        try {
            this.currentPasswordHash = pwm.makePassword(new SecureUTF8String(newPassword),
                    masterPwdHashAccount, getPasswordSalt());
        } catch (Exception ignored) {}
        setStorePasswordHash(true);
    }
165132
public void decrypt(byte[] password) throws GeneralSecurityException {
        if (!isEncrypted()) {
            return;
        }

        byte[] enc = Base64.decode(this.encodedKey);

        SecretKeySpec key = getSecretKey(password, this.initializationVector.getIV());

        Cipher cipher = getCipher();
        cipher.init(Cipher.DECRYPT_MODE, key, this.initializationVector);
        enc = cipher.doFinal(enc);

        this.intKey = getKey(this.keyAlg, enc);
        this.keyData = enc;
        this.isEncrypted = false;
        this.encodedKey = null;
    }
769229
public void clear() {

        /**
         * Unfortunately log4j's MDC historically never had a mechanism to block remove keys,
         * so we're forced to do this one by one.
         */
        for (String key : allKeys()) {
           mdcBridge.remove(key);
        }

        PER_THREAD_CONTEXTS.getUnchecked(Thread.currentThread()).clear();
    }
750301
def reset_passwd(self, data):
        
        error = False
        msg = ""

        # Check input format
        if len(data["passwd"]) < 6:
            error = True
            msg = _("Password too short.")
        elif data["passwd"] != data["passwd2"]:
            error = True
            msg = _("Passwords don't match !")

        if not error:
            passwd_hash = hashlib.sha512(data["passwd"].encode("utf-8")).hexdigest()
            user = self.database.users.find_one_and_update({"reset": data["reset_hash"]},
                                                           {"$set": {"password": passwd_hash},
                                                            "$unset": {"reset": True, "activate": True}})
            if user is None:
                error = True
                msg = _("Invalid reset hash.")
            else:
                msg = _("Your password has been successfully changed.")

        return msg, error
886998
public function pwd($pwd = null) {
		$pwdToHash = null;
		if (!empty($pwd)) {
			$pwdToHash = $pwd;
		}
		while (empty($pwdToHash) || mb_strlen($pwdToHash) < 2) {
			$pwdToHash = $this->in(__('Password to Hash (2 characters at least)'));
		}
		$this->hr();
		$this->out('Password:');
		$this->out($pwdToHash);

		$hasher = 'Default';
		$hashType = Configure::read('Passwordable.passwordHasher');
		if ($hashType) {
			$hasher = $hashType;
		}
		$passwordHasher = PasswordHasherFactory::build($hasher);
		$pwd = $passwordHasher->hash($pwdToHash);

		$this->hr();
		$this->out('Hash:');
		$this->out($pwd);

		$this->hr();
		$this->out('resetting...');

		/** @var \App\Model\Table\UsersTable $Users */
		$Users = TableRegistry::get(CLASS_USERS);
		$this->Users = $Users;
		if (!$this->Users->hasField('password')) {
			$this->abort(CLASS_USERS . ' table doesnt have a password field!');
		}

		if (empty($this->params['dry-run'])) {
			$count = $this->Users->updateAll(['password' => $pwd], ['password !=' => $pwd]);
		} else {
			$count = $this->Users->find('all', ['conditions' => [CLASS_USERS . '.password !=' => $pwd]])->count();
		}
		$this->out($count . ' pwds resetted - DONE');
	}
617183
public static final void decodeBuffer(byte[] data, byte encryptionCode)
   {
      for (int i = 0; i < data.length; i++)
      {
         data[i] = (byte) (data[i] ^ encryptionCode);
      }
   }