443,652 Members | 1,337 Online
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

# Quirk in Konqueror 5 core JS ?

 P: n/a Greetings. This problem arises in the context of the CPAN module Crypt::Tea ... It works with IE, Mozilla, Netscape, Firefox, IE and Opera, but if you check out http://www.pjb.com.au/comp/test.html using Konqueror 5.0 (at least on linux) you will find: tea_code((2048299521,595110280), (-764348263,554905533,637549562,-283747546)) returns 1614127572, 339082849, should be -451692928, 1589210186, tea_decode((2048299521,595110280), (-764348263,554905533,637549562,-283747546)) returns 2022045126, -1848224228, should be -257148566, -1681954940, :-( Now these two functions are quite short, similar and simple: function tea_code (v, k) { // TEA. 2-int (64-bit) cyphertext block in v. 4-int (128-bit) key in k. var v0 = v[0]; var v1 = v[1]; var k0 = k[0]; var k1 = k[1]; var k2 = k[2]; var k3 = k[3]; var sum = 0; var n = 32; while (n-- > 0) { sum -= 1640531527; // TEA magic number 0x9e3779b9 sum = sum|0; // force it back to 32-bit int v0 += ((v1<<4)+k0) ^ (v1+sum) ^ ((v1>>>5)+k1) ; v1 += ((v0<<4)+k2) ^ (v0+sum) ^ ((v0>>>5)+k3) ; } var w = new Array(); w[0] = v0|0; w[1] = v1|0; return w; } function tea_decode (v, k) { // TEA. 2-int (64-bit) cyphertext block in v. 4-int (128-bit) key in k. var v0 = v[0]; var v1 = v[1]; var k0 = k[0]; var k1 = k[1]; var k2 = k[2]; var k3 = k[3]; var sum = 0; var n = 32; sum = -957401312 ; // TEA magic number 0x9e3779b9<<5 while (n-- > 0) { v1 -= ((v0<<4)+k2) ^ (v0+sum) ^ ((v0>>>5)+k3) ; v0 -= ((v1<<4)+k0) ^ (v1+sum) ^ ((v1>>>5)+k1) ; sum += 1640531527; // TEA magic number 0x9e3779b9 ; sum = sum|0; // force it back to 32-bit int } var w = new Array(); w[0] = v0|0; w[1] = v1|0; return w; } Is there perhaps some known quirk in Konqueror's handling of core operators like << >>> | or ^ ? Regards, Peter -- Peter Billam, DPIWE/ILS/CIT/Servers, hbt/lnd/l8, 6233 3061 Jul 23 '05 #1