# Re: how shd i improve upon this algorithm(ne suggestions)

From: Ankur Taly (ankurtaly_at_iitb.ac.in)
Date: 07/17/04

```Date: 16 Jul 2004 22:08:43 -0700

```

Michael Amling <nospam@nospam.com> wrote in message news:<8RQJc.1102\$vf2.658@newssvr31.news.prodigy.com>...
> Ankur Taly wrote:
>
> > So to encrypt a char 'x' we first find its ascii,then index and then
> > the group .Pick a random no from this group.For eg a random no from
> > the group (5mod16,4mod16) is (37,68).
> > Also our groups are restricted such that both nos in the group must be
> > less than 255.
> > Next the pair is replaed by two charcters first havin index same as
> > the first no in random pair(37,68 in the above eg),second havin index
> > same as the second no in the pair.
> > Now we encrypt a character by this pair of characters.For eg if the
> > random no generated is 37,68 and the char with index 37 is \$ and that
> > with 68 is F then the pair of charactes is \$F
> > So encrypt this x we send \$F.
> >
> > now each time since the random no pair generated for the same charcter
> > would be different ,the pair of charcters would also be diff and hence
> > repeated ocurences of the same character would be encrypted by diff
> > pairs of charcters.
> >
> > This would take care of the Statistical method of decryption.Also the
> > key has a variety of 256!(factorial)
>
>

<<<< How does the recipient decrypt the message? In particular, what
is
> the key?
> How long will this method remain secure against adversaries that know
> how it works but don't have the key?
>
> --Mike Amling >>>>

As i had written in the prev posting that the random permutation
generated will
decide the ascii to index mapping for every character .
This random permutation would be the secret key.This key is obviously
private.

Now at the other end if the decryptor knows this permutation then he
can find out the reverse index to ascii relation and so he can decrypt
the message

For eg at the other end if the person receives '\$F'.HE finds out the
index of \$ and F using the permutation(key).THis index comes out to be
37 and 68 respectively.
Next he finds 37 is 5modulo16 and 68 is 4modulo 16.So the group comes
out to be 5mod16,4mod16. This means that the index of the original
charcter must have left quotient 5 and remainder 4 when divided by 16.

So he finds the index for the original character as i = 5*16+4 =84.
Using the permutation he finds out the ascii corresponding to the
index 84.Using this he can find out the original character

THe above eg. deals with characters but we can generalize it.If we
read byte by byte we can have an equivalent char for each byte with
its ascii equal to the integer equivalent of the byte.Take the byte as
'unsigned'.

We see that the sensitivity of the ciphertext to the key would
increase if we consider 'Derangements'instead of permutations.(so in
this case no two permutations will have nos in the same place as
before.)

-ankur