类 UArgon2

java.lang.Object
com.gdxsoft.easyweb.utils.UArgon2

public class UArgon2 extends Object

Function Argon2

Inputs:
  1. password (P): Bytes (0..232-1) Password (or message) to be hashed
  2. salt (S): Bytes (8..232-1) Salt (16 bytes recommended for password hashing)
  3. parallelism (p): Number (1..224-1) Degree of parallelism (i.e. number of threads)
  4. tagLength (T): Number (4..232-1) Desired number of returned bytes
  5. memorySizeKB (m): Number (8p..232-1) Amount of memory (in kibibytes) to use
  6. iterations (t): Number (1..232-1) Number of iterations to perform
  7. version (v): Number (0x13) The current version is 0x13 (19 decimal)
  8. key (K): Bytes (0..232-1) Optional key (Errata: PDF says 0..32 bytes, RFC says 0..232 bytes)
  9. associatedData (X): Bytes (0..232-1) Optional arbitrary extra data
  10. hashType (y): Number (0=Argon2d, 1=Argon2i, 2=Argon2id)
Output:
tag: Bytes (tagLength) The resulting generated bytes, tagLength bytes long
  • 构造器详细资料

    • UArgon2

      public UArgon2()
  • 方法详细资料

    • hashPwd

      public static String hashPwd(String password)
      Hash the password
      参数:
      password -
      返回:
      the hashed password
    • verifyPwd

      public static boolean verifyPwd(String plainPassword, String hashedPassword)
      Verify password
      参数:
      plainPassword - the plain password
      hashedPassword - the hashed password
      返回:
      true = successful, false = fail
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • getBuilder

      public org.bouncycastle.crypto.params.Argon2Parameters.Builder getBuilder()
    • verifyPassword

      public boolean verifyPassword(String plainPassword, String hashedPassword)
      Verify password
      参数:
      plainPassword -
      hashedPassword -
      返回:
      true/false
    • checkPassword

      public boolean checkPassword()
    • hashPassword

      public String hashPassword(String password)
    • initVerifyParameter

      public void initVerifyParameter(String encodedHash) throws IllegalArgumentException, IOException
      抛出:
      IllegalArgumentException
      IOException
    • getArgon2Type

      public int getArgon2Type()
    • setArgon2Type

      public void setArgon2Type(int argon2Type)
    • getVersion

      public int getVersion()
    • setVersion

      public void setVersion(int version)
    • getParallelity

      public int getParallelity()
    • setParallelity

      public void setParallelity(int parallelity)
    • getMemory

      public int getMemory()
    • setMemory

      public void setMemory(int memory)
    • getIterations

      public int getIterations()
    • setIterations

      public void setIterations(int iterations)
    • getSaltLength

      public int getSaltLength()
    • setSaltLength

      public void setSaltLength(int saltLength)
    • getSalt

      public byte[] getSalt()
    • setSalt

      public void setSalt(byte[] salt)
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String password)
    • getPasswordHash

      public byte[] getPasswordHash()
    • setPasswordHash

      public void setPasswordHash(byte[] passwordHash)