Knuckle Cracker

Creeper World 2 => Code Mission Discussion => Topic started by: Grauniad on November 26, 2011, 05:23:55 PM

Title: Competition: Find a duplicate code map
Post by: Grauniad on November 26, 2011, 05:23:55 PM
By my estimation there may be as many as 2 x10100 different code strings that may map onto each of the 232-1 code maps that can be generated. If you ever come across a duplicate, post both strings that generate the same map in this thread.

Any competition should have a prize, you say? Well, the accolade of your fellow forumers should be enough, no?
Title: Re: Competition: Find a duplicate code map
Post by: Echo51 on November 26, 2011, 06:28:12 PM
Funny, i started on this a few days ago :P


My "app" just reported it has found one, sadly i was AFK so didn't notice what it was. Minor changes being done and i'll get results :D


Title: Re: Competition: Find a duplicate code map
Post by: creeper killer on November 27, 2011, 01:21:15 AM
anyone here a computer wiz?
they could write a program that plugs in all possible combinations and records the results
Title: Re: Competition: Find a duplicate code map
Post by: Echo51 on November 27, 2011, 05:45:31 AM
Here we go, verified by hand and found in about 15 minutes with a poorly written flash app(~100 hashes per second at ~50k entries).

"82945"
and
"25302"
Both produce the same code map when entered into CW2 :)
Title: Re: Competition: Find a duplicate code map
Post by: UpperKEES on November 27, 2011, 07:37:23 AM
Nice job, Echo! :)
Title: Re: Competition: Find a duplicate code map
Post by: lich98 on November 27, 2011, 10:48:52 AM
nice echo you get a prize! A FREE MAP!
Title: Re: Competition: Find a duplicate code map
Post by: thepenguin on November 27, 2011, 11:33:19 AM
echo, what is the flash hash function called?, (I'm looking for a java equivalent, to find a ton of duplicates, added on to my list of 1K things to do :P)
Title: Re: Competition: Find a duplicate code map
Post by: Grauniad on November 27, 2011, 11:49:01 AM
MD5 Hash.
Title: Re: Competition: Find a duplicate code map
Post by: thepenguin on November 27, 2011, 12:47:53 PM
Quote from: Grauniad on November 27, 2011, 11:49:01 AM
MD5 Hash.

great.

wait, what? md5 hashes are not 32-bit hashes
Title: Re: Competition: Find a duplicate code map
Post by: Echo51 on November 27, 2011, 01:01:28 PM
It is not include in AS3 by default, the one you want is available here: https://github.com/mikechambers/as3corelib/tree/master/src/com/adobe/crypto
Title: Re: Competition: Find a duplicate code map
Post by: miquelfire on November 29, 2011, 01:55:18 PM
Quote from: thepenguin on November 27, 2011, 12:47:53 PM
Quote from: Grauniad on November 27, 2011, 11:49:01 AM
MD5 Hash.

great.

wait, what? md5 hashes are not 32-bit hashes

You take the first 8 hex characters (4 bytes if your hash output that way) of the hash, so the rate of collision is much higher.
Title: Re: Competition: Find a duplicate code map
Post by: thepenguin on November 29, 2011, 08:20:57 PM
Quote from: miquelfire on November 29, 2011, 01:55:18 PM
Quote from: thepenguin on November 27, 2011, 12:47:53 PM
Quote from: Grauniad on November 27, 2011, 11:49:01 AM
MD5 Hash.

great.

wait, what? md5 hashes are not 32-bit hashes

You take the first 8 hex characters (4 bytes if your hash output that way) of the hash, so the rate of collision is much higher.

much better, I get it now ...
Title: Re: Competition: Find a duplicate code map
Post by: mopa42 on November 30, 2011, 07:28:39 PM
Oh boy! A programming challenge!

I found a whole bunch of duplicate codes. Here are some of the most interesting / funny / unique:












for some applethink were apple
garden a gamethe chair said
the car timemake big play
April 29, 1027April 29, 2830
woodruffinaccuracies
sketchablecalash's
difficulties designingpainful data
dead eatingdefines nice
chairman attackinvents crater
Creeper submittedsuspending weather
zero blameeaten Creeper

And even some triplicates!



absolute beautifulwoman foot'sposts statistics
fundamentally obscureresponses passessentially managing

The codes have this to say about Virgil:




bytes sourceme Virgil
continue buysVirgil product
satisfy ownersVirgil fastest

(Virgil is the fastest at turning sources into games into satisfied owners into continued buying of the product)
CW2 itself says that Virgil is a great developer!

Some of the codes, being four random words, are unintentionally hilarious. I spent far too much time just reading through the list laughing.
If you're curious I've attached the list of all ~45 thousand duplicates I found.
Title: Re: Competition: Find a duplicate code map
Post by: UpperKEES on November 30, 2011, 07:48:14 PM
Mopa, you keep amazing me....

Indeed some hilarious combinations! ;D

Great job! 8)
Title: Re: Competition: Find a duplicate code map
Post by: thepenguin on November 30, 2011, 08:14:22 PM
hey, mopa, I can't seem to be able to get the right hashes for this in java, how're you doing it?
Title: Re: Competition: Find a duplicate code map
Post by: mopa42 on November 30, 2011, 10:47:14 PM
Quote from: thepenguin on November 30, 2011, 08:14:22 PM
hey, mopa, I can't seem to be able to get the right hashes for this in java, how're you doing it?
(I'm assuming you're asking about how to compute the hash of a code)

Here's what I used for my score fetcher (in Java)

public static long getSeedFromString(String str) {
    str = str.toLowerCase().trim();
    String hex = DigestUtils.md5Hex(str).substring(0, 8);
    return Long.parseLong(hex, 16);
}

It uses this module for ease: org.apache.commons.codec.digest.DigestUtils (http://commons.apache.org/codec/)
I use a long (64 bits) since java ints are signed and I needed the full unsigned 32 bits to store the hash without hassle.

I actually wrote my program in C++ since I knew I would need speed and large amounts of memory (I ended up getting about 150k hashes per sec). I used MD5 from here (http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5). I can show my source code if that would help, but I'd have to go clean it up first.

(And as a side note, I have successfully completed a reverse mapping of hash to code for all 2^32 seeds. If anyone needs a seed looked up for some reason just ask.)
Title: Re: Competition: Find a duplicate code map
Post by: Cavemaniac on December 01, 2011, 04:51:25 AM
Quote from: mopa42 on November 30, 2011, 07:28:39 PM
If you're curious I've attached the list of all ~45 thousand duplicates I found.

Holy smoke - you're amazing/crazy!

Your next challenges:

The back porch on my house is collapsing - should I re-pile it, or just bodge it up?

I've got this shooting pain in my left arm - could it be a heart attack?

;D
Title: Re: Competition: Find a duplicate code map
Post by: Echo51 on December 01, 2011, 04:57:57 AM
And thus has the challenge most probably ended since mopa found all the hashes for each and every possible seed :P
Title: Re: Competition: Find a duplicate code map
Post by: Grauniad on December 01, 2011, 08:52:31 AM
I think you (Echo51) are the winner for the first duplication found, Mopa42 for the most duplicates. However, by my reckoning we have barely scratched the surface, since there may be more duplicates per map than there are maps. See my first post for my estimation.
Title: Re: Competition: Find a duplicate code map
Post by: Echo51 on December 01, 2011, 09:23:02 AM
Well there are 2^32 different maps, but strings are limited to 60^however many different symbols you can enter into the field. So you could probably find like 5 unique strings for each map if you would bother ;)
Title: Re: Competition: Find a duplicate code map
Post by: Kithros on December 01, 2011, 09:40:07 AM
Quote from: Echo51 on December 01, 2011, 09:23:02 AM
Well there are 2^32 different maps, but strings are limited to 60^however many different symbols you can enter into the field. So you could probably find like 5 unique strings for each map if you would bother ;)


*MUCH* more than just 5 strings per map - you would have (number of symbols)^60 possible strings, and roughly 2^32 different maps - so even if there were just 32 different symbols (obviously there are more than that - just numbers and letters gives 36 symbols completely ignoring all the strange symbols) you would then have 2^300 different strings ((2^5)^60 = 2^300) - which means you would have on average about 2^268 ((2^300)/(2^32)) duplicates of each map. Since there are more than 32 symbols, the number will be even bigger than that.
Title: Re: Competition: Find a duplicate code map
Post by: Grauniad on December 01, 2011, 09:49:07 AM
*Sigh* Yes, initially I calcualted that somewhere on the order of 2 x10100 strings will result in the same map. Is my first post not clear?

Let me say it in another way. For each and every one of the actual 4 billion code maps, there are two duotrigintillion different code strings that can generate that particular map.

Of course, I may be off by one or two zeros, but whose counting? :)
Title: Re: Competition: Find a duplicate code map
Post by: Echo51 on December 01, 2011, 10:40:21 AM
More like who cares, we've found plenty of maps with several strings each, why bother hunting for more :D
Title: Re: Competition: Find a duplicate code map
Post by: Grauniad on December 01, 2011, 10:50:35 AM
Absolutely. it would be rather tedious to continue.