Jump to content

SL3NCK - Calculate NCK's from TARGET_HASH and MASTER_SP_CODE


Kyan
 Share

Recommended Posts

Hi, SL3NCK calculates the 7 NCK's levels used for unlocking SL3 phones.

SL3NCK("0000000000000000000000000000000000000000", "080803080307030003010002020305")

_output:

#pw+283037116581614+1#
#pw+235518432205471+2#
#pw+595388505163502+3#
#pw+415333744058839+4#
#pw+259299316395048+5#
#pw+467723677207791+6#
#pw+690485095019780+7#

You can test run and see is the same code output as in the following websites:

#include <Crypt.au3>

; #Function# ===========================================================================================================
; Name...........: SL3NCK
; Description ...: Calculates 7 NCK levels for SL3.
; Syntax.........: SL3NCK("TARGET_HASH","MASTER_SP_CODE")
; Return values .: string with 7 levels NCK's.
; Author ........: kyan (autoIT code), oOXTCOo (PHP code).
; Remarks .......: $TargetHash is a string with 40 hex chars. $MasterSP is a string with 30 digits.
; Related .......: SimlFeistel(), _packH()
; Requeires .....: #include <Crypt.au3>
; ===============================================================================================================================
Func SL3NCK($TargetHash, $MasterSP)
    $result = ''
    $MasterSP = '000000' & StringMid($MasterSP, 0 + 1, 24)
    For $i = 1 To 7
        $hash = _packH('0' & $i & $TargetHash)
        $hash = StringTrimLeft(StringUpper(_Crypt_HashData($hash, $CALG_SHA1)), 2)
        $precode8 = StringMid($MasterSP, 0 + 1, 16)
        $precode7 = StringMid($MasterSP, 17 + 1, 30)
        For $magic = 0 To 1
            $sh = _packH('0' & $magic & StringMid($hash, 0 + 1, 32) & $precode8)
            $sh = StringTrimLeft(StringUpper(_Crypt_HashData($sh, $CALG_SHA1)), 2)
            $precode = SimlFeistel($sh, $precode7)
            $precode7 = $precode

            $sh = _packH('0' & $magic & StringMid($hash, 0 + 1, 32) & $precode)
            $sh = StringTrimLeft(StringUpper(_Crypt_HashData($sh, $CALG_SHA1), 2)
            $precode = SimlFeistel($sh, $precode8, 8)
            $precode8 = $precode
        Next
        $final = $precode8 & $precode7
        $x = 1
        $nck = ''
        For $y = 1 To 15
            $nck = $nck & StringMid($final, $x + 1, 1)
            $x += 2
        Next
        $result &= '#pw+' & $nck & '+' & $i & '#' & @CRLF
    Next
    Return $result
EndFunc   ;==>SL3NCK

Func SimlFeistel($sh, $precode, $bytes = 7)
    Local $result = '', $j = 0, $nck = '', $nck2 = ''
    While ($j < ($bytes * 2))
        $nck = StringMid($sh, $j + 1, 1) & StringMid($sh, $j + 2, 1)
        $nck2 = StringMid($precode, $j + 1, 1) + StringMid($precode, $j + 2, 1)
        $prenck = Mod((Dec($nck) + Dec($nck2)), 10)
        $result = $result & '0' & $prenck
        $j += 2
    WEnd
    Return $result
EndFunc   ;==>SimlFeistel

Func _packH($sInput)
    Local $sReply = ""
    For $xx = 1 To StringLen($sInput) Step 2
        $sReply &= Chr(Dec(StringMid($sInput, $xx, 2)))
    Next
    Return $sReply
EndFunc   ;==>_packH by Luigi

Hope it comes handy for someone :D

PS: You can't unlock a phone only with this. Google is your friend.

Edited by Kyan

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there'sĀ InetReadĀ and WinHTTP, way better
happy.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...