I wanted to unlock my operator locked Huawei e1750 modem. After googling I found this page in swedish.
The unlock code can be calculated by using the IMEI number, the unlock code is sent by using AT commands.
I have succesfully tested this on e1750 and e1550.
I also tried it on e220 and it did not work.
1. Get the IMEI number
Normally this is printed on the device put the geek way of getting it is by asking the device:
peter@peter-laptop:~/huawei$ cat /dev/ttyUSB0 & [1] 9378 peter@peter-laptop:~/huawei$ echo -e "ATI\r" > /dev/ttyUSB0 peter@peter-laptop:~/huawei$ ATI Manufacturer: huawei Model: E1750 Revision: 11.126.07.04.00 IMEI: 123456789012347 +GCAP: +CGSM,+DS,+ES OK
So the IMEI number is: 123456789012347
2. Calculate the unlock code
The following python script will calculate the unlock code:
import hashlib def getCode(imei, salt): digest = hashlib.md5((imei+salt).lower()).digest() code = 0 for i in range(0,4): code += (ord(digest[i])^ord(digest[4+i])^ord(digest[8+i])^ord(digest[12+i])) << (3-i)*8 code &= 0x1ffffff code |= 0x2000000 return code # Your IMEI goes here: imei = "123456789012347" print "Unlock code: %s" % getCode(imei, "5e8dd316726b0335") print "Flash code: %s" % getCode(imei, "97b7bc6be525ab44")
When run:
peter@peter-laptop:~/huawei$ python unlock_code.py Unlock code: 36963763 Flash code: 53969249
3. Use the unlock code
peter@peter-laptop:~/huawei$ echo -e 'AT^CARDLOCK="36963763"\r' > /dev/ttyUSB0 OK
Congratulations, now your modem is unlocked
17 Responses to “Unlock Huawei modems”
Leave a Reply
You must be logged in to post a comment.
May 16th, 2010 at 1:22 pm
Try this online calculator, to calculate huawei codes.
http://www.wintechmobiles.com/unlocking/huawei-modem-unlock-by-code-do-it-yourself-free/
June 22nd, 2010 at 4:34 am
Hello!
I have a Huawei E169, what is recognized by Ubuntu Lucid as E220 .
I followed, your instructions and I have managed to unlock my card at the first try. I never thought that unlocking is so easy.
The last thing what I would have tried, to search the solutions on a swedish page.
So thank you!
July 15th, 2010 at 12:25 am
Hello again!
Now I have a Huawei E630 PCMCIA modem from Vodafone, and I have managed to unlock as well with this script.
July 15th, 2010 at 12:12 pm
Great that you have had some use for my blog.
Interesting that you managed to unlock your E220 when I failed.
Best regards
Peter
August 7th, 2010 at 4:44 pm
My card in fact was E169, but the Ubuntu recognised it as E220. Maybe on a real E220 it wouldn’t work for me as well.
August 7th, 2010 at 6:07 pm
Sorry, I read it to fast. You clearly said it was not an e220.
January 29th, 2011 at 5:02 pm
it works with my e1750 modem, thankyou!!
March 24th, 2011 at 4:02 pm
unlocking code won’t work with a newer flash versions
ATE1 V1
OK
ATI
Manufacturer: huawei
Model: E1750
Revision: 11.126.08.01.00
IMEI: 355013044430084
+GCAP: +CGSM,+DS,+ES
OK
AT^CARDLOCK=53226303
+CME ERROR: incorrect password
March 27th, 2011 at 3:14 pm
Put :
AT^CARDLOCK=”53226303″
April 3rd, 2011 at 6:35 pm
Hi,
i am trying on my e1750..
AT^CARDLOCK=37656595
+CME ERROR: operation not allowed
OK
or with “..”
no differneces.. looking like some other problem.
(also not accepting any PIN code.. also “operation not allowed” result..)
Any idea?
thx
May 17th, 2011 at 9:21 pm
Hello,
One more success story with an E1750. Thanks a lot!
Had to fiddle around for sometime though, since the modem did not exactly respond as expected. A few reboots and some permutations later, the modem said “OK”.
A couple of questions out of curiosity though:
– how are the values for ‘salt’ arrived at?
– why is a ‘flash code’ is calculated by the program, but not used anywhere?
August 23rd, 2011 at 6:07 pm
Just successfully unlocked (I think, no error msgs!) my E180 with this tutorial. Thanks so much! 🙂
Email me if you take bitcoin tips!
August 9th, 2012 at 9:00 pm
Awesome! I just unlocked two Huawei modems successfully. Many thanks!!
September 27th, 2012 at 8:21 pm
MANY MANY THANKS MAN!!!! you made my day!
October 29th, 2013 at 8:35 am
Thank You! It worked for me, too. Really easy for begginers! 🙂
December 2nd, 2013 at 10:31 pm
Hi, very helpful instructions to input the code, however the new E398 modems require a new algorithm. I tried the one in this page and it worked: http://www.modemunlock.com/huawei-new-algo-unlock-code-calculator.html
Also, remember to put the code "in quotation marks":
ATI
Manufacturer: huawei
Model: UMG366
Revision: 11.809.09.00.420
IMEI: 355293040991384
+GCAP: +CGSM,+FCLASS,+DS
OK
AT^CARDLOCK=38970669
+CME ERROR: incorrect password
AT^CARDLOCK=98890911
+CME ERROR: incorrect password
AT^CARDLOCK="38970669"
+CME ERROR: incorrect password
AT^CARDLOCK="98890911"
OK
Did it using CoolTerm in Mac
March 20th, 2014 at 10:26 pm
@augustin:
Why does that page require one to register with google mail account? Fishing spam targets…