From 1cfc19954193ac9802cb01433aab0fbc85e708c6 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sat, 19 May 2018 12:47:27 -0400 Subject: [PATCH] Reorder some methods. --- .../lyndir/masterpassword/MPAlgorithm.java | 36 +++++++++--------- .../masterpassword/impl/MPAlgorithmV0.java | 38 +++++++++---------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/core/java/algorithm/src/main/java/com/lyndir/masterpassword/MPAlgorithm.java b/core/java/algorithm/src/main/java/com/lyndir/masterpassword/MPAlgorithm.java index d575333a..04cde420 100644 --- a/core/java/algorithm/src/main/java/com/lyndir/masterpassword/MPAlgorithm.java +++ b/core/java/algorithm/src/main/java/com/lyndir/masterpassword/MPAlgorithm.java @@ -105,6 +105,11 @@ public abstract class MPAlgorithm { */ public abstract Version version(); + /** + * mpw: defaults: initial counter value. + */ + public abstract UnsignedInteger mpw_default_counter(); + /** * mpw: defaults: password result type. */ @@ -121,14 +126,14 @@ public abstract class MPAlgorithm { public abstract MPResultType mpw_default_answer_type(); /** - * mpw: defaults: initial counter value. + * mpw: Input character encoding. */ - public abstract UnsignedInteger mpw_default_counter(); + public abstract Charset mpw_charset(); /** - * mpw: validity for the time-based rolling counter (s). + * mpw: Platform-agnostic byte order. */ - public abstract long mpw_otp_window(); + public abstract ByteOrder mpw_byteOrder(); /** * mpw: Key ID hash. @@ -140,16 +145,6 @@ public abstract class MPAlgorithm { */ public abstract MessageAuthenticationDigests mpw_digest(); - /** - * mpw: Platform-agnostic byte order. - */ - public abstract ByteOrder mpw_byteOrder(); - - /** - * mpw: Input character encoding. - */ - public abstract Charset mpw_charset(); - /** * mpw: Master key size (byte). */ @@ -166,9 +161,14 @@ public abstract class MPAlgorithm { public abstract int mpw_keySize_max(); /** - * scrypt: Parallelization parameter. + * mpw: validity for the time-based rolling counter (s). */ - public abstract int scrypt_p(); + public abstract long mpw_otp_window(); + + /** + * scrypt: CPU cost parameter. + */ + public abstract int scrypt_N(); /** * scrypt: Memory cost parameter. @@ -176,9 +176,9 @@ public abstract class MPAlgorithm { public abstract int scrypt_r(); /** - * scrypt: CPU cost parameter. + * scrypt: Parallelization parameter. */ - public abstract int scrypt_N(); + public abstract int scrypt_p(); // Utilities diff --git a/core/java/algorithm/src/main/java/com/lyndir/masterpassword/impl/MPAlgorithmV0.java b/core/java/algorithm/src/main/java/com/lyndir/masterpassword/impl/MPAlgorithmV0.java index bb0b2f33..8711a175 100644 --- a/core/java/algorithm/src/main/java/com/lyndir/masterpassword/impl/MPAlgorithmV0.java +++ b/core/java/algorithm/src/main/java/com/lyndir/masterpassword/impl/MPAlgorithmV0.java @@ -247,6 +247,11 @@ public class MPAlgorithmV0 extends MPAlgorithm { return MPAlgorithm.Version.V0; } + @Override + public UnsignedInteger mpw_default_counter() { + return UnsignedInteger.ONE; + } + @Override public MPResultType mpw_default_result_type() { return MPResultType.GeneratedLong; @@ -263,14 +268,13 @@ public class MPAlgorithmV0 extends MPAlgorithm { } @Override - public UnsignedInteger mpw_default_counter() { - return UnsignedInteger.ONE; + public Charset mpw_charset() { + return Charsets.UTF_8; } @Override - @SuppressWarnings("MagicNumber") - public long mpw_otp_window() { - return 5 * 60 /* s */; + public ByteOrder mpw_byteOrder() { + return ByteOrder.BIG_ENDIAN; } @Override @@ -283,16 +287,6 @@ public class MPAlgorithmV0 extends MPAlgorithm { return MessageAuthenticationDigests.HmacSHA256; } - @Override - public ByteOrder mpw_byteOrder() { - return ByteOrder.BIG_ENDIAN; - } - - @Override - public Charset mpw_charset() { - return Charsets.UTF_8; - } - @Override @SuppressWarnings("MagicNumber") public int mpw_dkLen() { @@ -313,8 +307,14 @@ public class MPAlgorithmV0 extends MPAlgorithm { @Override @SuppressWarnings("MagicNumber") - public int scrypt_p() { - return 2; + public long mpw_otp_window() { + return 5 * 60 /* s */; + } + + @Override + @SuppressWarnings("MagicNumber") + public int scrypt_N() { + return 32768; } @Override @@ -325,8 +325,8 @@ public class MPAlgorithmV0 extends MPAlgorithm { @Override @SuppressWarnings("MagicNumber") - public int scrypt_N() { - return 32768; + public int scrypt_p() { + return 2; } // Utilities