Hallo, vielleicht kann mir hier ja jemand helfen, hab ein Java Programm wo am Ende folgender verschlüsselter Text bei rauskommt:
Hex: 2219b1041244c6e25203e40101d4cfda8c0ddded1af89946f7047693812cab8c5a3f4cf422d131f2d939ca83433c1215c6c5 ad7a

Das Java Programm soll eine Schwachstelle haben um den Text leicht zu entschlüsseln:
class StreamCipher1 {

private byte S[] = new byte[256];
private int ii = 0, jj = 0;

public void keysetup(byte[] key)
{
for (int i = 0; i < 256; i++)
{
S[i] = (byte) i;
}

int i = 0;
byte c;

for (int j = 0; j < 256; j++)
{
i = (j + key[i % 3]) % 8;
c = S[i];
S[i] = S[j];
S[j] = c;
}
}

public byte encrypt(byte c)
{
ii = (ii + 1) % 256;
jj = (jj + S[ii]) % 256;
if (jj < 0)
{
jj += 256;
}

byte h = S[ii];
S[ii] = S[jj];
S[jj] = h;
return (byte) (S[ii] ^ c);
}

public static void main(String[] argv)
{
byte[] key = new byte[8];
byte[] message = new String("");
// initialisation of key and plaintext removed

byte c;
StreamCipher1 s = new StreamCipher1();

s.keysetup(key);

for (int i = 0; i < message.length; i++)
{
c = s.encrypt(message[i]);
System.out.print(Integer.toHexString(c + 128));
}

// resulting ciphertext is 2219b1041244c6e25203e40101d4cfda8c0ddded1af89946f7047693812cab8c5a3f4cf422d131f2d939ca83433c1215c6c5 ad7a

}
}

Wäre Super wenn hier jemand die Schwachstelle sieht/findet.

Gruß, AyCaramba