Okay, here is an old cut and copy guide on how to jailbreak and unlock the iPhone 3G running 3.1.2.
You're lucky, you can still unlock. Here you go:
JAILBREAK/UNLOCK IPHONE 3G*
Go to blackra1n.com and download blackra1n..
IF YOU JUST NEED TO UNLOCK AND ARE ALREADY JAILBROKEN, do this:
1) Open Cydia.*
2) Go to Manage.*
3) Go to Sources.*
4) Tap EDIT.
5) Tap ADD.*
6) Type "http://www.blackra1n.com"*
7) Tap OK.*
8) Go back to Manage/Sources, tap on the blackra1n source, and look for "sn0w".*
9) Install it.*
10) Reboot your iPhone
IF YOU HAVE NOT JAILBROKEN YET, open up blackra1n on your PC, and then click "Make it rain" and jailbreak your phone. This will also 'hacktivate' your phone with your alternate SIM card. *(Note: follow directions at the end of this post to fix Push Notifications, YouTube and Wi?Fi for hacktivated iPhones). *
YOU MAY NEED TO ATTEMPT THIS MULTIPLE TIMES FOR IT TO WORK CORRECTLY. Sometimes there are minor errors. Let it do it's thing. It is okay and even somewhat expected.*
Once blackra1n.app is installed to your springboard (a/k/a iPhone home screen), choose to install "sn0w"( a/k/a blacksn0w) from your iPhone. Once again, make sure it that you connect to Wi?Fi first. It will be the only way you can install Cydia/Rock if you're not on AT&T.*
1) Open up the "blackra1n.app" on your iPhone. *
2) Tap on "sn0w" until a green check mark appears next to it.*
3) Tap "install".*
4) Watch for the splash screen telling you that it was successful.
5) Turn your iPhone off.*
6) Insert your new SIM card.*
7) Turn the iPhone back on. **
After installing sn0w, install Cydia.*
1) Open up the "blackra1n.app" on your iPhone. *
2) Tap on "Cydia" until a green check mark appears next to it.*
3) Tap "install".*
Cydia will ask you questions, and to update. Select "Graphical User", and "Update All". Let it restart and reboot. Once it does it's thing... **
-OPTIONAL-
If you have data or MMS problems with ANY carrier, you may want to google or wikipedia "iPhone APN Settings" to find a way to fix those issues. However, if the plan for the cell carrier SIM card you've inserted does not include data, then your Internet/e-Mail/maps/gps etc won't work. You will have to add data/MMS to that SIM cards plan for them to officially work.*
Voil?. You're updated, jailbroken, and unlocked on 3.1.2.
ADDITIONAL NOTES:
For some, the new blackra1n HACKTIVATED jailbreak was causing problems with Wi-Fi, YouTube, and Push Notifications. Here is a quick guide on how to fix these problems.
Wi?Fi
1. Go to Settings>General>Reset>Reset Network Settings, then click "OK"
2. Reboot your iPhone, when it comes back on Wi?Fi should be fixed, but next time you reboot you have to do this again.*
YouTube and Push Notifications FIX for "hacktivated" iPhones.*
1. Open Cydia
2. Search for "Push Doctor" or "Push Doc", and tap on the first result
3. Install then confirm
4. Reboot your iPhone.