fix k function
This commit is contained in:
parent
2a35bbbfab
commit
51a4b2d9bc
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
@ -1,10 +1,12 @@
|
||||
package ch.fhnw.kry;
|
||||
|
||||
public class SPN {
|
||||
private final static int ROUND_KEY_LENGTH = 16;
|
||||
|
||||
public int k(int key, int i) {
|
||||
i *= 4;
|
||||
int mask = 0xFFFF >>> i;
|
||||
int mask = 0xFFFF_0000 >>> i;
|
||||
|
||||
return key & mask;
|
||||
return key & mask >>> ROUND_KEY_LENGTH - i;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user