Re: Encryption & Decryption script



..oO(Willem Bogaerts)

I get bored last night and wrote a script that uses xor for encrypt-
decrypt, however it woks fine under linux 2.6.25, text and documents
are ok, but fails on compressed files *.jpg, *.pdf , etc . I didn't
test script on windows.

I did not look at the code, but xor on PHP is quite counter-intuitive.
The most significant bit is seen as a sign bit and is treated special.

Can you elaborate on that or give an example?

<?php
$foo = 129; // 10000001b
$bar = 66; // 01000010b
$huh = 200; // 11001000b
var_dump(decbin($foo ^ $bar)); // 11000011b
var_dump(decbin($foo ^ $huh)); // 01001001b
var_dump(decbin($bar ^ $huh)); // 10001010b
var_dump(decbin($foo ^ $bar ^ $huh)); // 00001011b
?>

All as expected.

Micha
.



Relevant Pages

  • Re: PHP running exec() Windows program very slow in comparison to UNIX equivalent program
    ... So, by converting a VB6 DLL into a COM and calling the COM from PHP I am able to work around the speed limitations of swetest.exe, PHP, and Windows. ... I wrote a little program in VB5 that essentially does what this other compiled C Windows program does in just one of the loops that gets executed about 140 times. ... the other thing is how long it takes to to execute the program with those statements from a command prompt. ...
    (alt.php)
  • RE: phpBB Worm
    ... the getpwent function is not supported on Windows. ... it probably depends on the web server ... I looked at the decoded Perl script, ... was invoked by PHP, which should have the Web server's permissions, ...
    (Bugtraq)
  • Re: MS Access im Intranet / Internet
    ... Ich habe nichts gegen Webanwendungen, ... dass in Access als dafuer ... > MS Windows, MS IE. ... PHP oder ASP oder ASP.net ...
    (microsoft.public.de.access)
  • Re: Developing PHP under Windows - Why?
    ... Windows 2000, Apache 2, Microsoft SQL Server, and PHP. ... We went with the Windows route mainly for human resource reason. ... I knew virtually nothing about Linux at the time - and very little about Apache. ...
    (comp.lang.php)
  • Re: Looking for e-commerce recommendations
    ... I believe Miva is a CGI/Pearl type script. ... I'm certain OS Commerce is PHP ... regarding the fp extensions/ windows environment: ... runs surprisingly well on a windows server so it'll be OK. ...
    (microsoft.public.frontpage.programming)