Package ghidra.framework.generic.auth

# Class Password

java.lang.Object
ghidra.framework.generic.auth.Password

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class Password extends Object implements Closeable
Wrapper for a password, held in a char[] array.

`Closing` an instance will clear the characters of the char array.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Password`
  `clone()`
  `void`
  `close()`
  Clears the password characters by overwriting them with '\0's.
  `static Password`
  `copyOf(char[] password)`
  Creates a new `Password` using a copy the specified characters.
  `boolean`
  `equals(Object obj)`
  `char[]`
  `getPasswordChars()`
  Returns a reference to the current password characters.
  `int`
  `hashCode()`
  `static Password`
  `wrap(char[] password)`
  Creates a new `Password` by wrapping the specified character array.

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### copyOf

    public static Password copyOf(char[] password)
    Creates a new `Password` using a copy the specified characters.
    Parameters:
      `password` - password characters
    Returns:
      new `Password` instance

  - ### wrap

    public static Password wrap(char[] password)
    Creates a new `Password` by wrapping the specified character array.

    The new instance will take ownership of the char array, and clear it when the instance is `closed`.

    Parameters:
      `password` - password characters
    Returns:
      new `Password` instance

  - ### clone

    public Password clone()
    Overrides:
      `clone` in class `Object`

  - ### close

    public void close()
    Clears the password characters by overwriting them with '\0's.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`

  - ### getPasswordChars

    public char[] getPasswordChars()
    Returns a reference to the current password characters.
    Returns:
      reference to the current password characters

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`