add bit string to int array conversion

This commit is contained in:
Sebastian Hugentobler 2022-03-21 09:38:13 +01:00
parent 1fd74c6ec3
commit 55876a7d33
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
2 changed files with 35 additions and 0 deletions

View file

@ -73,4 +73,16 @@ class SPNTest {
assertEquals(y, spn.encryptBlock(key, x));
assertEquals(x, spn.decryptBlock(key, y));
}
@Test
void strToArray() {
var spn = new SPN();
String input = "00000100110100100000101110111000000000101000111110001110011111110110000001010001010000111010000000010011011001110010101110110000";
int[] data = spn.strToArray(input);
assertEquals(8, data.length);
assertEquals(0x04D2, data[0]);
assertEquals(0x2BB0, data[data.length - 1]);
}
}