Cracking GC.coms genetic sequence.

For all your general chit chat, caching or not.
Post Reply
User avatar
The Ginger Loon
450 or more roots tripped over
450 or more roots tripped over
Posts: 824
Joined: 28 March 03 9:09 pm
Location: Tamworth
Contact:

Cracking GC.coms genetic sequence.

Post by The Ginger Loon » 23 June 03 1:52 pm

Greetings all.
<P>
Can someone out there please explain to me how to convert Jeremy's new GCxxxx code back into a real number? I've been using real numbers since day 1 to record Australia's caches onto my Full-List page over at teamCHOAS but now that the server has been rebooted the URL for a cache comes up as a gobbledygook string. Before it was a simple matter of cut & paste, but now the only real identifier seems to be the GC number (unless a cache has an encrypted clue which when decrypted reveals the "real number" in the URL.)
<P>Any takers?
<P>Regards,
<br />Loon

Ebenezer
150 or more caches found
150 or more caches found
Posts: 425
Joined: 03 June 03 5:12 pm
Location: Summer Hill, Sydney
Contact:

Post by Ebenezer » 23 June 03 2:29 pm

I have seen that sometimes I get redirected to a page that contains what I assume you describe as the gobbledygook numbers. I think this is just encoding some session information, and is not actually needed for the waypoint name.

It looks like the new numbers (like, above a certain range) are using some kind of base 31.

e.g.
0123456789ABCDEFGHJKMNPQRTVWXYZ

User avatar
The Ginger Loon
450 or more roots tripped over
450 or more roots tripped over
Posts: 824
Joined: 28 March 03 9:09 pm
Location: Tamworth
Contact:

Post by The Ginger Loon » 23 June 03 3:54 pm

Actually it's Base 32 (you left out "S").
<P>I guess what I'm looking for is a practical method of decoding a GCxxxx number back into decimal.
<P>For example;
GCG9TN = cache id=74981
<P>I know you drop off the GC prefix which leaves you with G9TN, but getting that back to a decimal number is proving a bit too much for me. <br />I've tried using a straight base 32 approach, but that would give me an id number of 566134 and there aren't that many caches out there (yet).

CacheMonkey
Posts: 19
Joined: 24 April 03 11:14 am
Location: Sydney

I had to crack this to fix CacheMonkey a while back

Post by CacheMonkey » 24 June 03 7:10 pm

Here is the Java code, probably not much use to you, but ill go over it quickly at the end

<pre>
private static int getValue(char val) {
switch (val) {
case '0' : return 0;
case '1' : return 1;
case '2' : return 2;
case '3' : return 3;
case '4' : return 4;
case '5' : return 5;
case '6' : return 6;
case '7' : return 7;
case '8' : return 8;
case '9' : return 9;
case 'A' : return 10;
case 'B' : return 11;
case 'C' : return 12;
case 'D' : return 13;
case 'E' : return 14;
case 'F' : return 15;
case 'G' : return 16;
case 'H' : return 17;
case 'J' : return 18;
case 'K' : return 19;
case 'M' : return 20;
case 'N' : return 21;
case 'P' : return 22;
case 'Q' : return 23;
case 'R' : return 24;
case 'T' : return 25;
case 'V' : return 26;
case 'W' : return 27;
case 'X' : return 28;
case 'Y' : return 29;
case 'Z' : return 30;
}
return -1;
}

public static Integer parseCode(String code) {
long result = 0;
if (!code.substring(0,2).equals("GC"))
return new Integer(-1); //not correct code
code = code.substring(2); //Chop off the prefix.
try {
result = Long.parseLong(code,16);
} catch (NumberFormatException e) {
//The first character must be more than hex can allow
//for last 3 chars
int val = getValue(code.charAt(1));
result = result + (31 * 31 * val);
val = getValue(code.charAt(2));
result = result + (31 * val);
val = getValue(code.charAt(3));
result = result + val;

//Calculate Multiple for 1st char
int multiple = getValue(code.charAt(0));
result += multiple * 4096;
}
return new Integer((int) result);
}
}
</pre>

The first method maps each character to its value, thats easy.<br>
The second method does the actual decoding. There a few steps.
<ul>
<li>First see if it just a normal hex number, if so decode it, otherwise use the complex method.
<li>The last 3 charcaters are caluculated using the standard base X number system logic where X is 31.
<li>The first character is treated as if it was part of standard hex number but allows values higher than 16, all the way up to 31.
</ul>
Thats probably as clear as mud, if you have any specific questions ill try to go into more detail, or i could provide a method in cachemonkey to export integers instead of these codes.

Brad.

Ebenezer
150 or more caches found
150 or more caches found
Posts: 425
Joined: 03 June 03 5:12 pm
Location: Summer Hill, Sydney
Contact:

Post by Ebenezer » 24 June 03 7:19 pm

The Ginger Loon wrote:Actually it's Base 32 (you left out "S").
31/32 - close enough. :D

User avatar
The Ginger Loon
450 or more roots tripped over
450 or more roots tripped over
Posts: 824
Joined: 28 March 03 9:09 pm
Location: Tamworth
Contact:

Post by The Ginger Loon » 25 June 03 12:19 am

Thanks Brad (CacheMonkey) for the code snippet. I think I get what it's doing though I'm not too familiar with Java Programming. I might have a shot at doing this in PHP after I study it a bit more.
<P>
Ebenezer you were right after all. I recall seeing another thread somewhere on this forum that said S was in the character set. I've been trying to crack this by hand the last few days at work and kept coming up with answers that were either way out or close but not right.
<P>
Personally I think this solution to the GCFFFF problem is a bit dumb and awkward but hey, what would I know, I'm only an end user... :roll:

Ebenezer
150 or more caches found
150 or more caches found
Posts: 425
Joined: 03 June 03 5:12 pm
Location: Summer Hill, Sydney
Contact:

Post by Ebenezer » 25 June 03 11:12 am

The Ginger Loon wrote: Ebenezer you were right after all. I recall seeing another thread somewhere on this forum that said S was in the character set.
<b>CC Engineer 1:</b> Mistakes? We never make mistakes!<br>
[Hole plug falls through hole]<br>
<b>CC Engineer 2:</b> Hmm. It looks like they went back to metric again without telling us.

User avatar
maccamob
10000 or more caches found
10000 or more caches found
Posts: 915
Joined: 04 April 03 6:37 pm
Location: Hoppers Crossing, VIC
Contact:

Post by maccamob » 25 June 03 3:44 pm

If you are on-line, go to the cache page and move your mouse over the 'log your visit' or 'watch this cache' field at the top right. The decimal cache ID will appear at the end of the url at the bottom of the browser window. The ID also appears near the end of the url if you mouse over the map links or the nearby cache links.

User avatar
The Ginger Loon
450 or more roots tripped over
450 or more roots tripped over
Posts: 824
Joined: 28 March 03 9:09 pm
Location: Tamworth
Contact:

Post by The Ginger Loon » 25 June 03 6:13 pm

Well spotted Maccamob!
<br />It's note quite a handy as doing the good ol' cut 'n' paste but it gets me there in the end... :)

Team GeoCoopers
650 or more caches found
650 or more caches found
Posts: 65
Joined: 02 April 03 6:29 pm
Location: Adelaide, South Australia
Contact:

Post by Team GeoCoopers » 30 June 03 11:11 pm

Or there is also the sligthly extended way of referencing a page by:

http://www.geocaching.com/seek/cache_de ... ?wp=gc1234

You just plug the cache id on the end

---
Jeremy
TeamGeoCoopers

User avatar
The Ginger Loon
450 or more roots tripped over
450 or more roots tripped over
Posts: 824
Joined: 28 March 03 9:09 pm
Location: Tamworth
Contact:

Post by The Ginger Loon » 01 July 03 9:54 am

Team GeoCoopers wrote:Or there is also the sligthly extended way of referencing a page by:

http://www.geocaching.com/seek/cache_de ... ?wp=gc1234

You just plug the cache id on the end
<P>That's very handy to know. I might have to adopt that method, although manually sorting caches in base31 is not quite as easy (but still do-able) as it is in base10... :?

User avatar
Papa Bear_Left
800 or more hollow logs searched
800 or more hollow logs searched
Posts: 2573
Joined: 03 April 03 12:28 am
Location: Kalamunda, WA
Contact:

Post by Papa Bear_Left » 01 July 03 9:56 am

The Ginger Loon wrote:... manually sorting caches in base31 is not quite as easy (but still do-able) as it is in base10... :?
A really serious cacher would get the extra fingers grafted on so he could count in base31 easily...

User avatar
The Ginger Loon
450 or more roots tripped over
450 or more roots tripped over
Posts: 824
Joined: 28 March 03 9:09 pm
Location: Tamworth
Contact:

Post by The Ginger Loon » 01 July 03 9:58 am

A really serious cacher would get the extra fingers grafted on so he could count in base31 easily...[/quote]
<P>At least I <i>have</i> fingers... :P

Post Reply