Main Page | Report this Page
Science Forum Index  »  Cryptography Forum  »  how to encrypt the 10-digit values into encrypted...
Page 1 of 1    

how to encrypt the 10-digit values into encrypted...

Author Message
makissy...
Posted: Fri Sep 25, 2009 11:08 pm
Guest
Hi All,
I have an assignment about increasing the security of the
system by encrypting the identification numbers in database.
how to encrypt the 10-digit values into encrypted 10-digit values?
i don't have any idea yet. Can anyone give me any idea. pls..

requirements
• Each plain text 10-digit value with digits in the
interval [0..9] should be encrypted to a 10-digit number
with digits in the interval [0..9].
• Each encrypted value of 10 digits should be possible to
decrypt back to a plain text 10-digit value.

Thanks for any guidance.
 
mockturtle...
Posted: Fri Sep 25, 2009 11:34 pm
Guest
On Sep 26, 11:08 am, makissy <maki... at (no spam) gmail.com> wrote:
[quote:bdfe34a880]Hi All,
I have an assignment about increasing the security of the
system by encrypting the identification numbers in database.
how to encrypt the 10-digit values into encrypted 10-digit values?
i don't have any idea yet. Can anyone give me any idea. pls..

requirements
•    Each plain text 10-digit value with digits in the
     interval [0..9] should be encrypted to a 10-digit number
     with digits in the interval [0..9].
•    Each encrypted value of 10 digits should be possible to
     decrypt back to a plain text 10-digit value.

Thanks for any guidance.
[/quote:bdfe34a880]
I do not know if this is a homework assignament. Anyway, I guess that
the tip I am going to give you will make no harm. What you need is
actually a permutation of the set S={ 0, 1, ..., 9_999_999_999 } ('_'
is used for readibility), so "transmitter" and "receiver" need to
agree (in a secure way) on a permutation of S.
 
rossum...
Posted: Sat Sep 26, 2009 3:36 am
Guest
On Sat, 26 Sep 2009 02:08:37 -0700 (PDT), makissy <makissy at (no spam) gmail.com>
wrote:

[quote:996a709a2b]Hi All,
I have an assignment about increasing the security of the
system by encrypting the identification numbers in database.
how to encrypt the 10-digit values into encrypted 10-digit values?
i don't have any idea yet. Can anyone give me any idea. pls..

requirements
• Each plain text 10-digit value with digits in the
interval [0..9] should be encrypted to a 10-digit number
with digits in the interval [0..9].
• Each encrypted value of 10 digits should be possible to
decrypt back to a plain text 10-digit value.

Thanks for any guidance.
Here is one possible idea.[/quote:996a709a2b]

Pick a different random 10 digit key for each ID you want to encrypt.

Do a digit by digit addition, mod 10 (9 + 3 = 2) to give the encrypted
cyphertext digits:

Plaintext: 1234567890
Key: 2857261930 +
-----------
Cyphertext: 3081728720

To decrypt use the same key and do the subtraction digit by digit, mod
10:

Cyphertext: 3081728720
Key: 2857261930 -
-----------
Plaintext: 1234567890

You will need to store the keys securely (which may mean encrypting
them with a master key). You should also change the keys regularly.
How regularly depends on how secure you need your application to be;
ideally change the key after every decryption.

Random keys must be generated using a cryptographically secure RNG.
Many systems have these built in now e.g. Java's SecureRandom or
Linux' dev/(u)random.

rossum
 
biject...
Posted: Sat Sep 26, 2009 5:04 am
Guest
On Sep 26, 5:17 am, Spinner <nos... at (no spam) nospam.net> wrote:
[quote:779f30a92e]makissy <maki... at (no spam) gmail.com> 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 10-digit values into encrypted 10-digit values?
i don't have any idea yet. Can anyone give me any idea. pls..

requirements
•    Each plain text 10-digit value with digits in the
    interval [0..9] should be encrypted to a 10-digit number
    with digits in the interval [0..9].
•    Each encrypted value of 10 digits should be possible to
    decrypt back to a plain text 10-digit value.

Thanks for any guidance.

A simple question: Why?  If there are are a million numbers, then 1 in
1000 random guesses will return a 'valid' answer.  

Also, there are only 1 billion possible key or result vallues. That is
an extremely small universe of possible answers.
Example: if you have 1 billion clear values, then encryption is
meaningless since any 10 digit result of encryption will result in a
10 digit clear value number - which will be some other number in the
set.

This question has been asked periodically in this group before if I
recall correctly.  

And as a useless aside, you might pick up a little obfuscation using
say letters A-J as the result, or the alphabet modulo 10 ( K = A = T,
etc.)  It all depends what you're trying to do - a 10 numerical digit
restriction on key space makes pretty much any sort of encryption
useless if the number of plain text values approaches the size of the
key space itself.
--
2+2!=5 even for extremely large values of 2
[/quote:779f30a92e]
The problem is defining secure. Secure from what?
If the user only has access to one number then
the adding of a single secret number is enough.
Just throw away the over flow.

If a person who wants to break the system has
access to several pairs of plain and encrypted numbers then the
problem is harder especially if
the plain ids are all close in values.

In this case the best security might be something
like having two arrays the number of which is the
number of ids. Set each element to minus one in
the first list. In the second list set the
values sequential to all possible id's. Then
assign value to the location in the first by going
down a random amount in second list. When you place
that id value in first list delete from second
list and shorten the second list by one entry.
Redo as needed.

Keep the two lists secret and only give the
id and encrypted value to the one who needs
to know the values.

David A. Scott
--
My Crypto code
http://bijective.dogma.net/crypto/scott19u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"
 
Spinner...
Posted: Sat Sep 26, 2009 5:17 am
Guest
makissy <makissy at (no spam) gmail.com> wrote:

[quote:a85ad268c9]Hi All,
I have an assignment about increasing the security of the
system by encrypting the identification numbers in database.
how to encrypt the 10-digit values into encrypted 10-digit values?
i don't have any idea yet. Can anyone give me any idea. pls..

requirements
• Each plain text 10-digit value with digits in the
interval [0..9] should be encrypted to a 10-digit number
with digits in the interval [0..9].
• Each encrypted value of 10 digits should be possible to
decrypt back to a plain text 10-digit value.

Thanks for any guidance.
[/quote:a85ad268c9]
A simple question: Why? If there are are a million numbers, then 1 in
1000 random guesses will return a 'valid' answer.

Also, there are only 1 billion possible key or result vallues. That is
an extremely small universe of possible answers.
Example: if you have 1 billion clear values, then encryption is
meaningless since any 10 digit result of encryption will result in a
10 digit clear value number - which will be some other number in the
set.

This question has been asked periodically in this group before if I
recall correctly.

And as a useless aside, you might pick up a little obfuscation using
say letters A-J as the result, or the alphabet modulo 10 ( K = A = T,
etc.) It all depends what you're trying to do - a 10 numerical digit
restriction on key space makes pretty much any sort of encryption
useless if the number of plain text values approaches the size of the
key space itself.
--
2+2!=5 even for extremely large values of 2
 
Paulo Marques...
Posted: Mon Sep 28, 2009 9:49 am
Guest
makissy wrote:
[quote:cf8f23bddb]Hi All,
I have an assignment about increasing the security of the
system by encrypting the identification numbers in database.
how to encrypt the 10-digit values into encrypted 10-digit values?
i don't have any idea yet. Can anyone give me any idea. pls..

requirements
• Each plain text 10-digit value with digits in the
interval [0..9] should be encrypted to a 10-digit number
with digits in the interval [0..9].
• Each encrypted value of 10 digits should be possible to
decrypt back to a plain text 10-digit value.

Thanks for any guidance.
[/quote:cf8f23bddb]
Search for the "Hasty pudding" trick.

--
Paulo Marques - www.grupopie.com

"God is love. Love is blind. Ray Charles is blind. Ray Charles is God."
 
Maaartin...
Posted: Wed Sep 30, 2009 10:25 am
Guest
On Sep 26, 1:17 pm, Spinner <nos... at (no spam) nospam.net> wrote:
[quote:5cce0a801e]A simple question: Why?  If there are are a million numbers, then 1 in
1000 random guesses will return a 'valid' answer.  
[/quote:5cce0a801e]
This is an answer I was given, too. And I consider your idea to be
very wrong.
Just a simple example:
What do I risk telling everybody that 9714 is my encrypted banking
PIN?

Or even simpler, we play a game, I think tail or head, if you guess
correctly, you win $1, otherwise I win $2.
To make it easier for you I tell you the encrypted value in advance,
it was tail.
Didn't I help you too much?

[quote:5cce0a801e]Also, there are only 1 billion possible key or result vallues. That is
an extremely small universe of possible answers.
Example: if you have 1 billion clear values, then encryption is
meaningless since any 10 digit result of encryption will result in a
10 digit clear value number - which will be some other number in the
set.
[/quote:5cce0a801e]
Again, I disagree.
The 10 digit number may be a bank account number somehow related to a
customer number in a company database. Using the bank account number
an attacker can (with some effort) identify the person, than they can
use the customer number to get more information, maybe something about
his solvency. So making the unecrypted data public would surely
violate something like a Personal Data Protection Act.

In case the numbers are encrypted there still may be some way of
finding out the person (e.g., comparing payments recorded in the
database with payments recorded by the bank) but they are much more
complicated.

Especially, telling you that the name of a person with encrypted
banking account 1236547891 is Maaartin makes no harm. Sure, you can
say, there're just 1e10 possibilities... and what?

The following links (based on Hasty Pudding) should help:

http://groups.google.com/group/sci.crypt/browse_thread/thread/b2ffff455c497ea2

http://groups.google.com/group/sci.crypt/browse_thread/thread/07f4b7607ae61681/c4bdd165ba12b92a?#c4bdd165ba12b92a
 
Paulo Marques...
Posted: Thu Oct 01, 2009 5:08 am
Guest
Maaartin wrote:
[quote:5d3cf09f6b][...]
The following links (based on Hasty Pudding) should help:

http://groups.google.com/group/sci.crypt/browse_thread/thread/b2ffff455c497ea2

http://groups.google.com/group/sci.crypt/browse_thread/thread/07f4b7607ae61681/c4bdd165ba12b92a?#c4bdd165ba12b92a
[/quote:5d3cf09f6b]
A more direct link might be:

http://richard.schroeppel.name:8015/hpc/hpc-spec

Just go down to the section "Encrypting Numbers and Dates".

--
Paulo Marques - www.grupopie.com

"Every drive dies; not every drive really lives."
-- Braveheart meets 21st century technology. :^)
 
pslind69...
Posted: Wed Oct 28, 2009 1:36 am
Guest
On 26 Sep., 10:08, makissy <maki... at (no spam) gmail.com> wrote:
[quote]Hi All,
I have an assignment about increasing the security of the
system by encrypting the identification numbers in database.
how to encrypt the 10-digit values into encrypted 10-digit values?
i don't have any idea yet. Can anyone give me any idea. pls..

requirements
•    Each plain text 10-digit value with digits in the
     interval [0..9] should be encrypted to a 10-digit number
     with digits in the interval [0..9].
•    Each encrypted value of 10 digits should be possible to
     decrypt back to a plain text 10-digit value.

Thanks for any guidance.
[/quote]
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 2-4 (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: 6-2=4, 6-2=4

Let's take the 3rd column:
5
3
--
8

becomes:
7
5

because: 5-8 = -3. We cant have a negative number, so we add 10 - and
it then

becomes 7. And the last digit: 3-8 = -5. -5 + 10 = 5

So as you can see it is pretty easy.

5) repeat steps 2-4 (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).
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Thu Dec 10, 2009 5:41 am