standard javadoc
This commit is contained in:
@@ -83,9 +83,9 @@ public class MacBasedPRF implements PRF {
|
||||
/**
|
||||
* Method doFinal.
|
||||
* @param M byte[]
|
||||
* @return byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#doFinal(byte[])
|
||||
*/
|
||||
|
||||
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PRF#doFinal(byte[]) */
|
||||
public byte[] doFinal(byte[] M) {
|
||||
byte[] r = mac.doFinal(M);
|
||||
return r;
|
||||
@@ -93,9 +93,9 @@ public class MacBasedPRF implements PRF {
|
||||
|
||||
/**
|
||||
* Method getHLen.
|
||||
* @return int
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#getHLen()
|
||||
*/
|
||||
|
||||
|
||||
* @return int * @see fr.xephi.authme.security.pbkdf2.PRF#getHLen() */
|
||||
public int getHLen() {
|
||||
return hLen;
|
||||
}
|
||||
@@ -103,8 +103,8 @@ public class MacBasedPRF implements PRF {
|
||||
/**
|
||||
* Method init.
|
||||
* @param P byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#init(byte[])
|
||||
*/
|
||||
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#init(byte[]) */
|
||||
public void init(byte[] P) {
|
||||
try {
|
||||
mac.init(new SecretKeySpec(P, macAlgorithm));
|
||||
|
||||
@@ -115,9 +115,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method deriveKey.
|
||||
* @param inputPassword String
|
||||
* @return byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String)
|
||||
*/
|
||||
|
||||
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String) */
|
||||
public byte[] deriveKey(String inputPassword) {
|
||||
return deriveKey(inputPassword, 0);
|
||||
}
|
||||
@@ -126,9 +126,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Method deriveKey.
|
||||
* @param inputPassword String
|
||||
* @param dkLen int
|
||||
* @return byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String, int)
|
||||
*/
|
||||
|
||||
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String, int) */
|
||||
public byte[] deriveKey(String inputPassword, int dkLen) {
|
||||
byte[] r = null;
|
||||
byte P[] = null;
|
||||
@@ -156,9 +156,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method verifyKey.
|
||||
* @param inputPassword String
|
||||
* @return boolean
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#verifyKey(String)
|
||||
*/
|
||||
|
||||
|
||||
* @return boolean * @see fr.xephi.authme.security.pbkdf2.PBKDF2#verifyKey(String) */
|
||||
public boolean verifyKey(String inputPassword) {
|
||||
byte[] referenceKey = getParameters().getDerivedKey();
|
||||
if (referenceKey == null || referenceKey.length == 0) {
|
||||
@@ -193,9 +193,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
|
||||
/**
|
||||
* Method getPseudoRandomFunction.
|
||||
* @return PRF
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#getPseudoRandomFunction()
|
||||
*/
|
||||
|
||||
|
||||
* @return PRF * @see fr.xephi.authme.security.pbkdf2.PBKDF2#getPseudoRandomFunction() */
|
||||
public PRF getPseudoRandomFunction() {
|
||||
return prf;
|
||||
}
|
||||
@@ -318,9 +318,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
|
||||
/**
|
||||
* Method getParameters.
|
||||
* @return PBKDF2Parameters
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#getParameters()
|
||||
*/
|
||||
|
||||
|
||||
* @return PBKDF2Parameters * @see fr.xephi.authme.security.pbkdf2.PBKDF2#getParameters() */
|
||||
public PBKDF2Parameters getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
@@ -328,8 +328,8 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method setParameters.
|
||||
* @param parameters PBKDF2Parameters
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setParameters(PBKDF2Parameters)
|
||||
*/
|
||||
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setParameters(PBKDF2Parameters) */
|
||||
public void setParameters(PBKDF2Parameters parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
@@ -337,8 +337,8 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method setPseudoRandomFunction.
|
||||
* @param prf PRF
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setPseudoRandomFunction(PRF)
|
||||
*/
|
||||
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setPseudoRandomFunction(PRF) */
|
||||
public void setPseudoRandomFunction(PRF prf) {
|
||||
this.prf = prf;
|
||||
}
|
||||
@@ -357,7 +357,8 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Supply the password as argument.
|
||||
|
||||
|
||||
* @throws IOException * @throws NoSuchAlgorithmException */
|
||||
* @throws IOException * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
throws IOException, NoSuchAlgorithmException {
|
||||
String password = "password";
|
||||
|
||||
@@ -37,9 +37,9 @@ public class PBKDF2HexFormatter implements PBKDF2Formatter {
|
||||
* Method fromString.
|
||||
* @param p PBKDF2Parameters
|
||||
* @param s String
|
||||
* @return boolean
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#fromString(PBKDF2Parameters, String)
|
||||
*/
|
||||
|
||||
|
||||
* @return boolean * @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#fromString(PBKDF2Parameters, String) */
|
||||
public boolean fromString(PBKDF2Parameters p, String s) {
|
||||
if (p == null || s == null) {
|
||||
return true;
|
||||
@@ -63,9 +63,9 @@ public class PBKDF2HexFormatter implements PBKDF2Formatter {
|
||||
/**
|
||||
* Method toString.
|
||||
* @param p PBKDF2Parameters
|
||||
* @return String
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#toString(PBKDF2Parameters)
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#toString(PBKDF2Parameters) */
|
||||
public String toString(PBKDF2Parameters p) {
|
||||
String s = BinTools.bin2hex(p.getSalt()) + ":" + String.valueOf(p.getIterationCount()) + ":" + BinTools.bin2hex(p.getDerivedKey());
|
||||
return s;
|
||||
|
||||
@@ -111,8 +111,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getIterationCount.
|
||||
* @return int
|
||||
*/
|
||||
|
||||
* @return int */
|
||||
public int getIterationCount() {
|
||||
return iterationCount;
|
||||
}
|
||||
@@ -127,8 +127,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getSalt.
|
||||
* @return byte[]
|
||||
*/
|
||||
|
||||
* @return byte[] */
|
||||
public byte[] getSalt() {
|
||||
return salt;
|
||||
}
|
||||
@@ -143,8 +143,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getDerivedKey.
|
||||
* @return byte[]
|
||||
*/
|
||||
|
||||
* @return byte[] */
|
||||
public byte[] getDerivedKey() {
|
||||
return derivedKey;
|
||||
}
|
||||
@@ -159,8 +159,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getHashAlgorithm.
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public String getHashAlgorithm() {
|
||||
return hashAlgorithm;
|
||||
}
|
||||
@@ -175,8 +175,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getHashCharset.
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public String getHashCharset() {
|
||||
return hashCharset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user