Reformatted code with new code style
This commit is contained in:
@@ -38,6 +38,7 @@ public class BinTools {
|
||||
* Simple binary-to-hexadecimal conversion.
|
||||
*
|
||||
* @param b Input bytes. May be <code>null</code>.
|
||||
*
|
||||
* @return Hexadecimal representation of b. Uppercase A-F, two characters
|
||||
* per byte. Empty string on <code>null</code> input.
|
||||
*/
|
||||
@@ -59,6 +60,7 @@ public class BinTools {
|
||||
*
|
||||
* @param s String containing hexadecimal digits. May be <code>null</code>
|
||||
* . On odd length leading zero will be assumed.
|
||||
*
|
||||
* @return Array on bytes, non-<code>null</code>. * @throws IllegalArgumentException
|
||||
* when string contains non-hex character
|
||||
*/
|
||||
@@ -84,6 +86,7 @@ public class BinTools {
|
||||
* Convert hex digit to numerical value.
|
||||
*
|
||||
* @param c 0-9, a-f, A-F allowd.
|
||||
*
|
||||
* @return 0-15 * @throws IllegalArgumentException
|
||||
* on non-hex character
|
||||
*/
|
||||
|
||||
@@ -83,6 +83,7 @@ public class MacBasedPRF implements PRF {
|
||||
* Method doFinal.
|
||||
*
|
||||
* @param M byte[]
|
||||
*
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PRF#doFinal(byte[])
|
||||
*/
|
||||
public byte[] doFinal(byte[] M) {
|
||||
@@ -103,6 +104,7 @@ public class MacBasedPRF implements PRF {
|
||||
* Method init.
|
||||
*
|
||||
* @param P byte[]
|
||||
*
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#init(byte[])
|
||||
*/
|
||||
public void init(byte[] P) {
|
||||
|
||||
@@ -38,6 +38,7 @@ public interface PBKDF2 {
|
||||
* Desired key length defaults to Pseudo Random Function block size.
|
||||
*
|
||||
* @param inputPassword Candidate password to compute the derived key for.
|
||||
*
|
||||
* @return internal byte array
|
||||
*/
|
||||
public abstract byte[] deriveKey(String inputPassword);
|
||||
@@ -47,6 +48,7 @@ public interface PBKDF2 {
|
||||
*
|
||||
* @param inputPassword Candidate password to compute the derived key for.
|
||||
* @param dkLen Specify desired key length
|
||||
*
|
||||
* @return internal byte array
|
||||
*/
|
||||
public abstract byte[] deriveKey(String inputPassword, int dkLen);
|
||||
@@ -57,6 +59,7 @@ public interface PBKDF2 {
|
||||
* PBKDF2Parameters.
|
||||
*
|
||||
* @param inputPassword Candidate password to compute the derived key for.
|
||||
*
|
||||
* @return <code>true</code> password match; <code>false</code> incorrect
|
||||
* password
|
||||
*/
|
||||
|
||||
@@ -120,6 +120,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* 48290A0B96C426C3:1000:973899B1D4AFEB3ED371060D0797E0EE0142BD04
|
||||
*
|
||||
* @param args Supply the password as argument.
|
||||
*
|
||||
* @throws IOException * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
@@ -162,6 +163,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Method deriveKey.
|
||||
*
|
||||
* @param inputPassword String
|
||||
*
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String)
|
||||
*/
|
||||
public byte[] deriveKey(String inputPassword) {
|
||||
@@ -173,6 +175,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
*
|
||||
* @param inputPassword String
|
||||
* @param dkLen int
|
||||
*
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String, int)
|
||||
*/
|
||||
public byte[] deriveKey(String inputPassword, int dkLen) {
|
||||
@@ -203,6 +206,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Method verifyKey.
|
||||
*
|
||||
* @param inputPassword String
|
||||
*
|
||||
* @return boolean * @see fr.xephi.authme.security.pbkdf2.PBKDF2#verifyKey(String)
|
||||
*/
|
||||
public boolean verifyKey(String inputPassword) {
|
||||
@@ -249,6 +253,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Method setPseudoRandomFunction.
|
||||
*
|
||||
* @param prf PRF
|
||||
*
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setPseudoRandomFunction(PRF)
|
||||
*/
|
||||
public void setPseudoRandomFunction(PRF prf) {
|
||||
@@ -262,6 +267,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* @param S Salt as array of bytes. <code>null</code> means no salt.
|
||||
* @param c Iteration count (see RFC 2898 4.2)
|
||||
* @param dkLen desired length of derived key.
|
||||
*
|
||||
* @return internal byte array * @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898 5.2</a>
|
||||
*/
|
||||
protected byte[] PBKDF2(PRF prf, byte[] S, int c, int dkLen) {
|
||||
@@ -291,6 +297,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
*
|
||||
* @return ceil(a/b) * @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898 5.2 Step
|
||||
* 2.</a>
|
||||
*/
|
||||
@@ -311,6 +318,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* @param S Salt as array of bytes
|
||||
* @param c Iteration count
|
||||
* @param blockIndex
|
||||
*
|
||||
* @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898 5.2 Step
|
||||
* 3.</a>
|
||||
*/
|
||||
@@ -350,6 +358,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* @param dest
|
||||
* @param offset
|
||||
* @param i
|
||||
*
|
||||
* @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898 5.2 Step
|
||||
* 3.</a>
|
||||
*/
|
||||
@@ -373,6 +382,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Method setParameters.
|
||||
*
|
||||
* @param parameters PBKDF2Parameters
|
||||
*
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setParameters(PBKDF2Parameters)
|
||||
*/
|
||||
public void setParameters(PBKDF2Parameters parameters) {
|
||||
|
||||
@@ -37,6 +37,7 @@ public interface PBKDF2Formatter {
|
||||
* Convert parameters to String.
|
||||
*
|
||||
* @param p Parameters object to output.
|
||||
*
|
||||
* @return String representation
|
||||
*/
|
||||
public abstract String toString(PBKDF2Parameters p);
|
||||
@@ -47,6 +48,7 @@ public interface PBKDF2Formatter {
|
||||
*
|
||||
* @param s String representation of parameters to decode.
|
||||
* @param p PBKDF2Parameters
|
||||
*
|
||||
* @return <code>false</code> syntax OK, <code>true</code> some syntax
|
||||
* issue.
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,7 @@ public class PBKDF2HexFormatter implements PBKDF2Formatter {
|
||||
*
|
||||
* @param p PBKDF2Parameters
|
||||
* @param s String
|
||||
*
|
||||
* @return boolean * @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#fromString(PBKDF2Parameters, String)
|
||||
*/
|
||||
public boolean fromString(PBKDF2Parameters p, String s) {
|
||||
@@ -64,6 +65,7 @@ public class PBKDF2HexFormatter implements PBKDF2Formatter {
|
||||
* Method toString.
|
||||
*
|
||||
* @param p PBKDF2Parameters
|
||||
*
|
||||
* @return String * @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#toString(PBKDF2Parameters)
|
||||
*/
|
||||
public String toString(PBKDF2Parameters p) {
|
||||
|
||||
@@ -46,6 +46,7 @@ public interface PRF {
|
||||
*
|
||||
* @param M Input data/message etc. Together with any data supplied during
|
||||
* initilization.
|
||||
*
|
||||
* @return Random bytes of hLen length.
|
||||
*/
|
||||
public byte[] doFinal(byte[] M);
|
||||
|
||||
Reference in New Issue
Block a user