Sorry, I cannot follow your problem, maybe because it's hard for me, thinking me
into other's minds. So I cannot see, why you don't want to pad your strings
with separator chars. Sorry for that, I apologize me.
AFAIK, the encryption process is such:
* The plaintext will get XOR-encrypted with a random one-time pad.
* For getting this on-time pad, we use a random number generator.
* This RNG needs a seed, which could be a hash of the plaintext.
* This seed needs to get encrypted with RSA and its public key.
Decryption would process like:
* The seed will get encrypted by RSA and private key.
* Then, this seed will feed the RNG so we rebuild the one-time pad.
* This one-time pad gets XORed with the encrypted text, resulting in plaintext.
1 2 3 4 5 6 7 8 9 10 11
|
// encryption:
seed := hash( plaintext )
one_time_pad := RNG( seed ) // Need to be longer than plaintext.
encrypted_text := plaintext XOR one_time_pad
encryptd_seed := RSA_encrypt( public_key, seed )
// decryption
seed := RSA_encrypt( private_key, encrypted_seed )
one_time_pad := rng( seed )
plaintext := encrypted_text XOR on_time_pad
|
The plain-text is now XOR-encrypted, and you don't need to bother about
number sizes.
If we choose the on-time-pad larger than our plaintext, others could not
even more comparing of file sizes.