Welcome to It-Slav.Net blog
Peter Andersson
peter@it-slav.net

I've already got a female to worry about. Her name is the Enterprise.
-- Kirk, "The Corbomite Maneuver", stardate 1514.0
02
May

 

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”

  1. Shankar Says:

    Try this online calculator, to calculate huawei codes.

    http://www.wintechmobiles.com/unlocking/huawei-modem-unlock-by-code-do-it-yourself-free/

  2. kvark Says:

    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!

  3. kvark Says:

    Hello again!

    Now I have a Huawei E630 PCMCIA modem from Vodafone, and I have managed to unlock as well with this script.

  4. peter Says:

    Great that you have had some use for my blog.

    Interesting that you managed to unlock your E220 when I failed.

    Best regards
    Peter

  5. kvark Says:

    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.

  6. peter Says:

    Sorry, I read it to fast. You clearly said it was not an e220.

  7. Andreas Says:

    it works with my e1750 modem, thankyou!!

  8. Dragos Says:

    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

  9. sionib Says:

    Put :
    AT^CARDLOCK=”53226303″

  10. Jaromir Says:

    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

  11. GP Says:

    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?

  12. Cathal Says:

    Just successfully unlocked (I think, no error msgs!) my E180 with this tutorial. Thanks so much! 🙂

    Email me if you take bitcoin tips!

  13. fitsoft Says:

    Awesome! I just unlocked two Huawei modems successfully. Many thanks!!

  14. ovi Says:

    MANY MANY THANKS MAN!!!! you made my day!

  15. Dominika Says:

    Thank You! It worked for me, too. Really easy for begginers! 🙂

  16. Agustin Says:

    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

  17. erich Says:

    @augustin:
    Why does that page require one to register with google mail account? Fishing spam targets…

Leave a Reply

Filled Under: english, Hints, sysadmin




Book reviews
FreePBX 2.5
Powerful Telephony Solutions






Asterisk 1.6
Build a feature rich telephony system with Asterisk






Learning NAGIOS 3.0





Cacti 0.8 Network Monitoring,
Monitor your network with ease!