no need to send the encrypted block twice
This commit is contained in:
parent
22fcf324e4
commit
f78d2e8124
2 changed files with 4 additions and 5 deletions
|
@ -40,13 +40,12 @@ public class CTR {
|
|||
*
|
||||
* @param block Encrypted block (only lower 16 bits get looked at).
|
||||
* @param idx Block index.
|
||||
* @param y Y at index idx.
|
||||
* @return Decrypted block (in the lower 16 bits of the int).
|
||||
*/
|
||||
public int decrypt(int block, int idx, int y) {
|
||||
public int decrypt(int block, int idx) {
|
||||
int e = (iv + idx) % (1 << BLOCK_LENGTH); // iv + i mod 2^16
|
||||
e = spn.encryptBlock(key, e); // yes, we need the encryption function, as this is CTR
|
||||
|
||||
return y ^ e;
|
||||
return block ^ e;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue