UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

87 lines (67 loc) 2.09 kB
<!-- Generated by Rakefile:build --> <strong> doufu </strong> on 2012-09-24 11:04:55 <br /> thanks <hr /> <strong> <a href="http://haloindex.com" rel="nofollow">Soulcyon</a> </strong> on 2011-04-07 09:09:32 <br /> <pre><code> s = utf8(s); var t = &quot;PUT THAT HUGE TABLE IN HERE&quot;, c = 0, i = -1, l = str.length - 1; c = c ^ -1; while( !!(i++ - l) ) c = ( c &gt;&gt;&gt; 8 ) ^ parseInt(t.substr( (c ^ s.charCodeAt(i) &amp; 255) * 9, 8 ), 16); return c ^ -1; </code></pre> <hr /> <strong> <a href="http://blog.kukawski.pl" rel="nofollow">Rafa? Kukawski</a> </strong> on 2011-03-20 16:08:55 <br /> @Benny Nissen: thanks for your report. The problem was inside utf8_encode function, that for null value didn't return empty string. This is now fixed in git. <hr /> <strong> <a href="beast.dk" rel="nofollow">Benny Nissen</a> </strong> on 2011-03-20 12:19:10 <br /> Passing 'null' (javascript null) gived different values on the client and server side. I pass the value as JSON so it might get 'translated' somewhere. Just to let somebody know. Benny <hr /> <strong> Marco </strong> on 2011-02-18 11:06:55 <br /> This function solves the bug that i've posted: http://stackoverflow.com/questions/2647935/javascript-crc32-function-and-php-crc32-not-matching <hr /> <strong> Marco </strong> on 2011-02-18 10:49:55 <br /> I think i've found a bug for this one. Input string: &quot;\x49\x44\x41\x54\x08\x1d\x01\x05\x00\xfa\xff\x00\x79\x00\x00\xff\x02\xe8\x01\x79&quot; (it's a substring of a png file). PHP crc: -1895555446 JS crc: 756484124 <hr /> <strong> <a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a> </strong> on 2008-04-06 10:50:51 <br /> @ T0bsn: I've updated the function. Thanks a lot!! <hr /> <strong> T0bsn </strong> on 2008-04-04 19:22:33 <br /> replace: <pre><code>if (typeof(crc) == &amp;quot;undefined&amp;quot;) { crc = 0; }</code></pre> with: <pre><code>var crc;</code></pre> ...and it works for every function exec. ;) <hr />