Kyan Posted February 22, 2015 Share Posted February 22, 2015 Hey I don't know PHP, was trying to get the same output of PHP pack function, already read http://php.net/manual/en/function.pack.php but didn't found a proper translation for "high nible" I tried with StringFormat('%X',"6D2222E8B845C7B2199357B5FAF9B2C57C8FDAB4") but isn't the same thing I found this page http://perplexed.co.uk/960_php_pack_function.htm but I don't know how to replicate it in autoit Can someone lend a hand and point me in the right direction? 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 Link to comment Share on other sites More sharing options...
Solution Luigi Posted February 22, 2015 Solution Share Posted February 22, 2015 @Kyan, try this: 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 Kyan 1 Visit my repository Link to comment Share on other sites More sharing options...
Kyan Posted February 22, 2015 Author Share Posted February 22, 2015 @Luigi, if is a non pair hex string like 7chrs long, how shoud I pad it? '0'&$7chrStr or $7chrStr&'0'? 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 Link to comment Share on other sites More sharing options...
Kyan Posted February 23, 2015 Author Share Posted February 23, 2015 (edited) it should be padded from the left. tested the output using this site http://writecodeonline.com/php/ (use bin2hex() on php and Binary() to check if the pack output matches) Edited February 23, 2015 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 Link to comment Share on other sites More sharing options...
Luigi Posted February 23, 2015 Share Posted February 23, 2015 pack's php have many options... in the past, I need a pack option too, after many try, I build the function above, I need the option H, becouse packH. but, have the another pack's options... Visit my repository Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 23, 2015 Moderators Share Posted February 23, 2015 BTW, packH looks nothing more than: Func _packH($sInput) Return ((StringLeft($sInput, 2) = "0x") ? _ BinaryToString($sInput):BinaryToString("0x" & $sInput)) EndFunc To me... or am I missing something? Kyan 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Kyan Posted February 25, 2015 Author Share Posted February 25, 2015 Damn, there's such inline operators? wow 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now