Skip to content

Commit

Permalink
Simplify HKDF interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
moxie0 committed Oct 20, 2014
1 parent 64b40df commit fcaa3f0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private byte[] expand(byte[] prk, byte[] info, int outputSize) {
ByteArrayOutputStream results = new ByteArrayOutputStream();
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.init(new SecretKeySpec(prk, "HmacSHA256"));

Expand All @@ -89,6 +89,5 @@ private byte[] expand(byte[] prk, byte[] info, int outputSize) {
}

protected abstract int getIterationStartOffset();
protected abstract int getIterationEndOffset();

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ public class HKDFv2 extends HKDF {
protected int getIterationStartOffset() {
return 0;
}

@Override
protected int getIterationEndOffset() {
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ public class HKDFv3 extends HKDF {
protected int getIterationStartOffset() {
return 1;
}

@Override
protected int getIterationEndOffset() {
return 1;
}
}

0 comments on commit fcaa3f0

Please sign in to comment.