fix k function
This commit is contained in:
parent
2a35bbbfab
commit
51a4b2d9bc
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package ch.fhnw.kry;
|
package ch.fhnw.kry;
|
||||||
|
|
||||||
public class SPN {
|
public class SPN {
|
||||||
|
private final static int ROUND_KEY_LENGTH = 16;
|
||||||
|
|
||||||
public int k(int key, int i) {
|
public int k(int key, int i) {
|
||||||
i *= 4;
|
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