encrypting byte[] array
843811Jan 20 2006 — edited Jan 20 2006Hi,
Lemme put it like this :
I have a byte array say
byte[] to_be_encrypted=new byte[length];
I also have another byte array which basically contains the encryption keys i.e. in this second byte array each byte value represents an encryption key. Lets saywe have this second array as
byte[] encryption_keys=new byte[4]; //if we have 4 encryption keys
Now I want to use the second byte array (the one representing encryption keys) to encrypt the first byte array (i.e. to_be_encrypted). There is one thing which should be kept in mind here. The size of 'to_be_encrypted' byte array should not change. This means I am looking for some algorithm which can be used to encrypt the bytes of 'to_be_encrypted' byte array individually (say encryption keys performing some XOR or NOT or some other operation on individual bytes of 'to_be_encrypted'). The encryption scheme should be such that after encrypting individual bytes (of 'to_be_encrypted' array) each encryption key should still remain significant i.e. have a role to play in decryption. What I mean by this can be explained by this simple case:
Suppose I have the byte array (representing the encryption keys) of length 4. This means every byte inside this array is basically an encryption key. Now suppose I choose an encryption scheme which basically XORs each individual byte of 'to_be_encrypted' byte array one by one with the encryption keys (individual bytes of 'encryption_keys' array). Now here it seems as if I have encrypted the data using 32 bits (8 bit each for each encryption key) but actually this encryption scheme is no good than 8 bit encryption. This is because encrypting each byte of 'to_be_encrypted' by XORing it with all the encryption keys one by one is equivalent to encrypting the byte with one single key which basically is the XOR of the four encryption keys. Thus even if i have used 4 bytes to encrypt the data , the end result is no good than encrypting with one single byte.
So I am looking for a sequence of operations at the end of which every encryption key is required to decrypt the data and no shortcut algorithm can be used to decrypt the data.
I am not looking for a very robust method. I am just looking for a decent encryption scheme which can make unsolicited decryption harder.
hope I made myself clear
waiting for response