From 0c4dbe5ca44f78a5f9eb5727a9a2bf62343ab9aa Mon Sep 17 00:00:00 2001 From: adolfintel Date: Thu, 14 Feb 2019 13:36:10 +0100 Subject: [PATCH 1/2] More troubleshooting --- doc.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc.md b/doc.md index 2b8b365..2c55bf2 100644 --- a/doc.md +++ b/doc.md @@ -451,6 +451,10 @@ This is a configuration issue. Make a file called web.config in wwwroot and adap ``` +#### ID obfuscation doesn't work (incorrect output, blank results image) +ID obfuscation only works on 64 bit PHP (requires PHP_INT_SIZE to be 8). +Note that older versions of PHP 5 on Windows use PHP_INT_SIZE of 4, even if they're 64 bit. If you're in this situation, update your PHP install. + ## Known bugs and limitations ### General * The ping/jitter test is measured by seeing how long it takes for an empty XHR to complete. It is not an acutal ICMP ping. Different browsers may also show different results, especially on very fast connections on slow devices. From 78c0190618605889971b278038ce0469315294eb Mon Sep 17 00:00:00 2001 From: adolfintel Date: Thu, 14 Feb 2019 17:04:01 +0100 Subject: [PATCH 2/2] Changed and simplified ID obfuscation algoritm. Sorry about that --- telemetry/idObfuscation.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/telemetry/idObfuscation.php b/telemetry/idObfuscation.php index 2b5b59b..3b4482a 100644 --- a/telemetry/idObfuscation.php +++ b/telemetry/idObfuscation.php @@ -18,22 +18,25 @@ function getObfuscationSalt(){ This is a simple reversible hash function I made for encoding and decoding test IDs. It is not cryptographically secure, don't use it to hash passwords or something! */ -function obfdeobf($id){ +function obfdeobf($id,$dec){ $salt=getObfuscationSalt()&0xFFFFFFFF; $id=$id&0xFFFFFFFF; - for($i=0;$i<16;$i++){ + if($dec){ $id=$id^$salt; - $salt=(($salt>>1)&0xFFFFFFFF)|(($salt&0x00000001)<<31); - $id=((0x0000FFFF&$id)<<16)|((0xFFFF0000&$id)>>16); - $id=(($id>>1)&0xFFFFFFFF)|(($id&0x00000001)<<31); + $id=(($id&0xAAAAAAAA)>>1)|($id&0x55555555)<<1; + $id=(($id&0x0000FFFF)<<16)|(($id&0xFFFF0000)>>16); + return $id; + }else{ + $id=(($id&0x0000FFFF)<<16)|(($id&0xFFFF0000)>>16); + $id=(($id&0xAAAAAAAA)>>1)|($id&0x55555555)<<1; + return $id^$salt; } - return $id; } function obfuscateId($id){ - return str_pad(base_convert(obfdeobf($id+1),10,36),7,0,STR_PAD_LEFT); + return str_pad(base_convert(obfdeobf($id+1,false),10,36),7,0,STR_PAD_LEFT); } function deobfuscateId($id){ - return obfdeobf(base_convert($id,36,10))-1; + return obfdeobf(base_convert($id,36,10),true)-1; } //IMPORTANT: DO NOT ADD ANYTHING BELOW THE PHP CLOSING TAG, NOT EVEN EMPTY LINES!