Re: how to encrypt the 10digit values into encrypted 10digit values?
 From: pslind69 <pslind69@xxxxxxxxx>
 Date: Wed, 28 Oct 2009 04:36:30 0700 (PDT)
On 26 Sep., 10:08, makissy <maki...@xxxxxxxxx> wrote:
Hi All,
I have an assignment about increasing the security of the
system by encrypting the identification numbers in database.
how to encrypt the 10digit values into encrypted 10digit values?
i don't have any idea yet. Can anyone give me any idea. pls..
requirements
• Each plain text 10digit value with digits in the
interval [0..9] should be encrypted to a 10digit number
with digits in the interval [0..9].
• Each encrypted value of 10 digits should be possible to
decrypt back to a plain text 10digit value.
Thanks for any guidance.
Hello,
I would do it like this (this method is easy on a piece of paper):
1) split the number into 2 rows of 5 digits
2) shift the digits in the first row 1 place the the left, and 2
places to the left
in the second row  appending the leftmost digits to the end
3) mod10 add each column's digits
4) mod10 subtract each column's calculated value from that column's
digits
5) repeat steps 24 (at least once)
6) add the key
It is very fast and very easy, and has the benefit over just simply
adding the key
to the number  that it adds diffusion, a very important property in
encryption
(changing the data in the smallest amount results in changes in the
entire cipher).
Let me show an example:
Number to be encrypted: 4685197643
Secret key (that you have created somehow): 5216940876
1) split number into 2 rows
46851
97643
2) shift places to the left
68514
64397
3) mod10 add each column's digits
68514
64397

22801 (modulo 10 addition of each column's digits)
4) mod10 subtract each column's calculated value from that column's
digits
46713
42596
Let me explain this step. First column:
6
6

2
and becomes:
4
4
because: 62=4, 62=4
Let's take the 3rd column:
5
3

8
becomes:
7
5
because: 58 = 3. We cant have a negative number, so we add 10  and
it then
becomes 7. And the last digit: 38 = 5. 5 + 10 = 5
So as you can see it is pretty easy.
5) repeat steps 24 (at least once)
46713
42596
....shifted:
67134
59642
6) mod10 add each column's digits
67134
59642

16776
7) mod10 subtract each column's calculated value from that column's
digits
51468
43976
8) add the key
5146843976 (straightened out)
5216940876 (key)

0352783742 = cipher (modulo 10 addition of the number and the key)
And the encryption is done.
To decrypt, just do everything in reverse:
0352783742 (cipher)
5216940876 (key)

5146843976 (modulo 10 subtraction)
51468
43976

94334 (mod 10 added)
.... 94334 mod10 subtracted
67134
59642
.... unshift
46713
42596
.... repeat these steps once more
46713
42596

88209 (mod 10 added)
.... 88209 mod10 subtracted
68514
64397
.... unshift
46851
97643
.... straighten
4685197643
And it's decrypted!
If you can't decrypt it, you made an error somewhere (errors happen
quite easily, so
you should always either: doublecheck the calculations or try to
decrypt it).
.
 Prev by Date: Strong 2048 bits blockcipher Algorithm
 Next by Date: Re: Strong 2048 bits blockcipher Algorithm
 Previous by thread: Re: how to encrypt the 10digit values into encrypted 10digit values?
 Next by thread: Re: Avalanche measure
 Index(es):
Relevant Pages
