a-z A-Z 0-9 -_.~
Partition the hex in to chunks of two and check if the hex corresponds to any of these values, if they do replace them with the unreserved char.
So that a hash such as,
123456789abcdef123456789abcdef123456789a
becomes,
%124Vx%9a%bc%de%f1%23Eg%89%ab%cd%ef%124Vx%9a
notice that hex 34 became 4 which is what it is in ASCII. You can test the correctness of your hashes using the tracker url but don't request from announce request from file,
http://some.tracker.com/file?info_hash=hash
If you get a torrent back that means you have the correct hash.
I have tried the above and failed. Here's my code:
$testStr = "123456789abcdef123456789abcdef123456789a" ConsoleWrite(_EncodeHash($testStr) & @CRLF) Func _EncodeHash($sString) If (Not IsString($sString)) Or $sString = "" Then Return SetError(1, 0, 0) Local $aArray = StringRegExp($sString, "(?s).{1," & 2 & "}", 3), $sEncodedHash For $i = 0 To UBound($aArray) -1 If StringInStr($sString, Chr(Dec($aArray[$i]))) Then $sEncodedHash &= Chr(Dec($aArray[$i])) Else $sEncodedHash &= "%" & $aArray[$i] EndIf Next Return $sEncodedHash EndFunc
If you follow the first link in my post there is an example but I'm unfamiliar with the language being used. Thanks for any help.
Edited by Decipher, 10 June 2012 - 11:42 AM.




This topic is locked

