mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 07:10:53 +03:00
@@ -41,12 +41,12 @@ public class BaseMAC
|
||||
|
||||
@Override
|
||||
public byte[] doFinal() {
|
||||
return mac.doFinal();
|
||||
return resizeToHashSize(mac.doFinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] doFinal(byte[] input) {
|
||||
return mac.doFinal(input);
|
||||
return resizeToHashSize(mac.doFinal(input));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +62,15 @@ public class BaseMAC
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] resizeToHashSize(byte[] buf) {
|
||||
if (bsize == defbsize)
|
||||
return buf;
|
||||
|
||||
byte[] result = new byte[bsize];
|
||||
System.arraycopy(buf, 0, result, 0, bsize);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockSize() {
|
||||
return bsize;
|
||||
|
||||
@@ -30,7 +30,6 @@ public class HMACMD596Test {
|
||||
private static final String EXPECTED_HMAC = "dff33c507463f9cf088a5ce8";
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testUpdateWithDoFinal() {
|
||||
HMACMD596 hmac = initHmac();
|
||||
hmac.update(PLAIN_TEXT);
|
||||
@@ -38,7 +37,6 @@ public class HMACMD596Test {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testDoFinalWithInput() {
|
||||
HMACMD596 hmac = initHmac();
|
||||
assertThat(Hex.toHexString(hmac.doFinal(PLAIN_TEXT)),
|
||||
|
||||
@@ -30,7 +30,6 @@ public class HMACSHA196Test {
|
||||
private static final String EXPECTED_HMAC = "24ddeed57ad91465c5b59dce";
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testUpdateWithDoFinal() {
|
||||
HMACSHA196 hmac = initHmac();
|
||||
hmac.update(PLAIN_TEXT);
|
||||
@@ -38,7 +37,6 @@ public class HMACSHA196Test {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testDoFinalWithInput() {
|
||||
HMACSHA196 hmac = initHmac();
|
||||
assertThat(Hex.toHexString(hmac.doFinal(PLAIN_TEXT)), is(EXPECTED_HMAC));
|
||||
|
||||
Reference in New Issue
Block a user