mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Simplify HKDF interface.
This commit is contained in:
parent
64b40df15b
commit
fcaa3f0d73
@ -63,7 +63,7 @@ public abstract class HKDF {
|
|||||||
ByteArrayOutputStream results = new ByteArrayOutputStream();
|
ByteArrayOutputStream results = new ByteArrayOutputStream();
|
||||||
int remainingBytes = outputSize;
|
int remainingBytes = outputSize;
|
||||||
|
|
||||||
for (int i= getIterationStartOffset();i<iterations + getIterationEndOffset();i++) {
|
for (int i= getIterationStartOffset();i<iterations + getIterationStartOffset();i++) {
|
||||||
Mac mac = Mac.getInstance("HmacSHA256");
|
Mac mac = Mac.getInstance("HmacSHA256");
|
||||||
mac.init(new SecretKeySpec(prk, "HmacSHA256"));
|
mac.init(new SecretKeySpec(prk, "HmacSHA256"));
|
||||||
|
|
||||||
@ -89,6 +89,5 @@ public abstract class HKDF {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract int getIterationStartOffset();
|
protected abstract int getIterationStartOffset();
|
||||||
protected abstract int getIterationEndOffset();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,4 @@ public class HKDFv2 extends HKDF {
|
|||||||
protected int getIterationStartOffset() {
|
protected int getIterationStartOffset() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getIterationEndOffset() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,4 @@ public class HKDFv3 extends HKDF {
|
|||||||
protected int getIterationStartOffset() {
|
protected int getIterationStartOffset() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getIterationEndOffset() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user