2
0

Reorder some methods.

This commit is contained in:
Maarten Billemont 2018-05-19 12:47:27 -04:00
parent c43cc73ad5
commit 1cfc199541
2 changed files with 37 additions and 37 deletions

View File

@ -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

View File

@ -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