There is an array of byte B[64] and an array of Sbox[] of 256 elements - but most of the numbers are more than 127. You need to perform type substitution:

 byte [] B = new byte[64]; //message of 512 bits //here 256 elements, but some of them more than 127 Sbox [] = {0xFC, 0xEE....}; for (i = 0; i < 64; i++) B [i] = (byte) (Sbox(B[i])) 

How do I keep Sbox[] or what kind of conversion to do so as not to lose information?

    1 answer 1

    No Judging by the question title, the Sbox array is of type char []. char in java takes 2 bytes. Do you want to push 256 * 2 = 512 bytes into 64? Yes, even judging by the code segment, if you take only the first 64 elements of the Sbox array, 128 bytes to 64, in general, it will not be possible to convert.