0

I was just wondering if there's a way to generate many different combinations of numbers and letters, based off of just one number/letter? For example:

From just this one String:

234jk43fc7898cfg58

We could generate MANY different combos like:

HGYTD786Gjhghjg76fghf8
8976sgh8976
cv34905bv7
435bv4875bvg487bv
45b6467ne456n
4n56n45n6

... where each generated string would end up being able to be recalculated BACK to its original String: 234jk43fc7898cfg58

Is this at all possible? I'd appreciate any help at all.

Thank you

  • 1
    Are you talking about encryption? Maybe that is not what you are after... what do you mean with "based off of just one number/letter"? – Dirk Vollmar Jul 08 '10 at 08:23
  • might be related: http://stackoverflow.com/questions/1330612/two-way-keyed-encryption-hash-algorithm – Shay Erlichmen Jul 08 '10 at 08:25
  • I am afraid I didn't understand your question. What do you need it for? – Grzenio Jul 08 '10 at 08:26
  • I'd pay good money for a function which could recover the original string **234jk43fc7898cfg58** from **4n56n45n6**. I'd even pay good money for a function which would generate **4n56n45n6** from **234jk43fc7898cfg58** which doesn't even contain the character **6**. – High Performance Mark Jul 08 '10 at 08:31
  • 2
    @High Performance Mark `f (string x) { return x == "234jk43fc7898cfg58" ? "4n56n45n6" : "234jk43fc7898cfg58"; }` meets your stated requirements; my invoice is in the post. – Pete Kirkham Jul 08 '10 at 08:38
  • @Mark: Thats a dangerous thing to say. =) For this one case the function could trivially only output 4n56n45n6 only only have one valid input... – Jens Jul 08 '10 at 08:43
  • @j-t-s: You need to be more specific about your requirements for the generates strings. Simply, say, appending an `a`, would surely not do it. – Jens Jul 08 '10 at 08:44
  • 1
    @Jens, @Pete: well, not so much dangerous as generous I think. Once I've checked the invoice the cheque will be 'in the post'. I promise. – High Performance Mark Jul 08 '10 at 09:00

2 Answers2

1

What you're looking for, in mathematics, is called a "Reversable Function".

Your combinations idea looks like a non starter, but there certainly are reversible functions available for dealing with data like this.

For instance, the existence of compression tools like Zip should give you hope...

What do you want the function for? If it's in anyway connected with cryptography my advice is to use the Cryptography features of .Net itself - don't try to reinvent a particularly complicated wheel. Added to which, the capabilties of .Net will far exceed anything you come up with. Not trying to put you down - just trying to be helpful...

Martin.

Martin Milan
  • 6,346
  • 2
  • 32
  • 44
  • I appreciate your help and advice, Martin. I am going to look at the Cryptography Class and also do some research of my own into Reversable Functions. The function will be used to generate random Strings, and the first customer's account number to match the original base string will win an entire year's subscription to my service for free. (I'm beinng very secretive about my new service as I do not want any details to get out before I've released it. ). Thank you very much for your help! :-) –  Jul 08 '10 at 09:33
0

For me this sounds like a compression algorithm (e.g. 7zip) to store the same information in lesser bytes or an encoding scheme (e.g. base64) to store the same information with only a subset of available byte combinations.

Oliver
  • 43,366
  • 8
  • 94
  • 151