-2
$\begingroup$

I'm new to cryptography and I am trying to figure out an equation that convert any big number to a smaller one and another one that reverse the operation to get the same big number again!

The problem here is every equation I use works fine with some numbers and others no.

I want one that works with all like:

Encrypted = Data - key
Data = Encrypted + key

But of course I want it to be more difficult :)

Can any one help me with that ?

$\endgroup$
  • $\begingroup$ Compressed binary numbers but with my own way,the length range is more than 500 numbers maybe :D and yes I'm thinking about encryption not compression $\endgroup$ – D4Vinci Jun 30 '16 at 5:45
  • 1
    $\begingroup$ "more than 500 numbers" - you mean digits? $\endgroup$ – tum_ Jun 30 '16 at 6:36
  • $\begingroup$ Yes I mean digits $\endgroup$ – D4Vinci Jun 30 '16 at 12:52
  • $\begingroup$ My immediate thought is to divide the huge number by a large enough power of 10, so that it is now small. $\endgroup$ – Garrison Pendergrass Oct 19 '16 at 17:51
4
$\begingroup$

What you're asking for is impossible by a very simple argument. If you're mapping a large number of things to a smaller number of things, more than one of the things from the bigger group will get mapped into the same thing in the smaller group. This is the pigeonhole principle.

When you get your "small number" there will be several different large numbers that could have been mapped to it. You won't be able to recover the original large number with any certainty.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Well, not necessarily - he(she) gave a good example of how smth like this can be achieved ;) But this has nothing to do with cryptography, of course. @VH4Ck - when dealing with crypto, rule #1 is "Don't invent your own ciphers", inventing a good one is (almost) impossible for a newbie, so why wasting your time... $\endgroup$ – tum_ Jun 30 '16 at 5:18
  • $\begingroup$ Thanks for your answer @A.Toumantsev I know you are right but the problem is..I can't stop my self from doing cuz I love crypto very much from the first article I read about crypto,I edited a lot of famous ciphers and made it stronger(like anyone can)then I decided to do one with myself and made many ones from the last month and python scripts for it but it always fail.! -thank u 4 trying to help me,I appreciate it $\endgroup$ – D4Vinci Jun 30 '16 at 5:38
  • $\begingroup$ OK, I will rephrase - no one can stop you from doing whatever you want to do. But questions like this, not actually related to cryptography, will be downvoted and eventually closed. Other people do not want to waste their time on things like that. $\endgroup$ – tum_ Jun 30 '16 at 6:34
  • $\begingroup$ Who can help me do it will help me.That's what I know and I won't despair.! $\endgroup$ – D4Vinci Jun 30 '16 at 12:50
1
$\begingroup$

Assuming the set of large numbers is small (otherwise you cannot represent them all as small numbers), what you are looking for can be broken into two steps:

  1. Transform the large numbers into small ones.
  2. Encrypt them.

The first problem is not really cryptographic. In the simplest case it can be simply subtraction. If your set of numbers is sparse it can be accomplished with a (minimal) perfect hash function - which I must warn you are not cryptographic hash functions. Such functions map a predefined set of values into another, which in this case you want to be small integers.

Once you have transformed the values, the choice of encryption depends on your requirements. Simplest and most secure would be using a normal authenticated encryption algorithm on them, but then you would again have large values. Some kind of format-preserving encryption may be required.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.