huawei calculation Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Guest

huawei calculation  Topic is solved

10 Jun 2016, 20:29

hello im new here

im trying to solve


;---------------------------------------------------------------------------------------------------------------------------------------
unlock code (imei 123456789012347):

MD5 ("1234567890123475e8dd316726b0335") = 8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b

8f xor 33 xor cc xor 6a =1a
43 xor 19 xor 57 xor 39 =34
ae xor c6 xor 40 xor 2d =05
1a xor 49 xor 8b xor 6b =b3

1a3405b3 and 1ffffff or 2000000 = 23405B3

hex2dec (23405B3) = 36963763 -> unlock code
;-----------------------------------------------------------------------------------------------------------------------------------------


my small proble is
how to trim or seperate byte blocks

md5 = 8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b


line1 8f 33 cc 6a
line2 43 19 57 39
line3 ae c6 40 2d
line4 1a 49 8b 6b


tnx in advance!

br
khail
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: huawei calculation

11 Jun 2016, 12:06

I'm not sure what you're trying to do, but this will probably help: SubStr
Image
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: huawei calculation

12 Jun 2016, 08:07

Like Weatherman i am not sure what you need :)

So i wild guess:

Code: Select all

md5 = 8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b
data:=strsplit(md5,a_space)

loop % data.maxindex()
{
if mod(a_index,4)
list .=data[a_index] " " 
else
list .=data[a_index] "`n"
}

msgbox %list%
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: huawei calculation

12 Jun 2016, 20:00

Code: Select all

md5 = 8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b

Loop, Parse, md5, %A_Space%, `n`r`t
{
    if (A_Index=1 || A_Index=5 || A_Index=9 || A_Index=13)
       row1 .= A_LoopField . ((A_Index = 13) ? "`n" : A_Space)
    else if (A_Index=2 || A_Index=6 || A_Index=10 || A_Index=14)
       row2 .= A_LoopField . ((A_Index = 14) ? "`n" : A_Space)
    else if (A_Index=3 || A_Index=7 || A_Index=11 || A_Index=15)
       row3 .= A_LoopField . ((A_Index = 15) ? "`n" : A_Space)
    else
       row4 .= A_LoopField . ((A_Index = 16) ? "`n" : A_Space)
}
 
msgbox % row1 row2 row3 row4
ExitApp
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: huawei calculation

21 Jan 2018, 08:05

- Here's a way.

Code: Select all

q:: ;list to table 'by columns' (specify row count)
vText := "8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b"
vNum := 4 ;row count
vSep := " "
oArray := StrSplit(vText, " ")
vOutput := ""
vIndex := 1
Loop, % oArray.Length()
{
	vOutput .= oArray[vIndex]
	vIndex += vNum
	if (vIndex > oArray.Length())
	{
		vIndex := Mod(vIndex, vNum) + 1
		vOutput .= "`r`n"
	}
	else
		vOutput .= vSep
}
MsgBox, % vOutput
return
- I've added 2 examples of list to table (by rows/columns), here:
jeeswg's strings tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=32985
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: huawei calculation

21 Jan 2018, 17:05

RegEx version:

Code: Select all

Code := "8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b"

Code := RegExReplace(code, " ")		;remove space characters

Reg1 := "(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)"

Reg2 := "" 
. "$1 $5 $9 ${13}`r`n"
. "$2 $6 ${10} ${14}`r`n"
. "$3 $7 ${11} ${15}`r`n"
. "$4 $8 ${12} ${16}"

msgbox, % RegExReplace(code, Reg1, Reg2)
StrSplit version:

Code: Select all

Code := "8f 43 ae 1a 33 19 c6 49 cc 57 40 8b 6a 39 2d 6b"

CodeArray := StrSplit(Code, " ")	;"Space" character as delimiter

msgbox, % ""
. CodeArray[1] " " CodeArray[5] " " CodeArray[9] " " CodeArray[13] "`r`n"
. CodeArray[2] " " CodeArray[6] " " CodeArray[10] " " CodeArray[14] "`r`n"
. CodeArray[3] " " CodeArray[7] " " CodeArray[11] " " CodeArray[15] "`r`n"
. CodeArray[4] " " CodeArray[8] " " CodeArray[12] " " CodeArray[16]

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jameswrightesq, wpulford and 412 guests