Tuesday, September 29, 2009

/* A JavaScript implementation of the SHA family of hashes, as defined in FIPS PUB 180-2 * as well as the corresponding HMAC implementation as defined in FIPS PUB 198a * Version 1.2 Copyright Brian Turek 2009 * Distributed under the BSD License * See http://jssha.sourceforge.net/ for more information * * Several functions taken from Paul Johnson */

/* * jsSHA is the workhorse of the library. Instantiate it with the string to be hashed * as the parameter * * @constructor * @param {String} srcString The string to be hashed * @param {String} inputFormat The format of srcString, ASCII or HEX */function jsSHA(srcString, inputFormat) {

K = [ new Int_64(0x428a2f98, 0xd728ae22), new Int_64(0x71374491, 0x23ef65cd), new Int_64(0xb5c0fbcf, 0xec4d3b2f), new Int_64(0xe9b5dba5, 0x8189dbbc), new Int_64(0x3956c25b, 0xf348b538), new Int_64(0x59f111f1, 0xb605d019), new Int_64(0x923f82a4, 0xaf194f9b), new Int_64(0xab1c5ed5, 0xda6d8118), new Int_64(0xd807aa98, 0xa3030242), new Int_64(0x12835b01, 0x45706fbe), new Int_64(0x243185be, 0x4ee4b28c), new Int_64(0x550c7dc3, 0xd5ffb4e2), new Int_64(0x72be5d74, 0xf27b896f), new Int_64(0x80deb1fe, 0x3b1696b1), new Int_64(0x9bdc06a7, 0x25c71235), new Int_64(0xc19bf174, 0xcf692694), new Int_64(0xe49b69c1, 0x9ef14ad2), new Int_64(0xefbe4786, 0x384f25e3), new Int_64(0x0fc19dc6, 0x8b8cd5b5), new Int_64(0x240ca1cc, 0x77ac9c65), new Int_64(0x2de92c6f, 0x592b0275), new Int_64(0x4a7484aa, 0x6ea6e483), new Int_64(0x5cb0a9dc, 0xbd41fbd4), new Int_64(0x76f988da, 0x831153b5), new Int_64(0x983e5152, 0xee66dfab), new Int_64(0xa831c66d, 0x2db43210), new Int_64(0xb00327c8, 0x98fb213f), new Int_64(0xbf597fc7, 0xbeef0ee4), new Int_64(0xc6e00bf3, 0x3da88fc2), new Int_64(0xd5a79147, 0x930aa725), new Int_64(0x06ca6351, 0xe003826f), new Int_64(0x14292967, 0x0a0e6e70), new Int_64(0x27b70a85, 0x46d22ffc), new Int_64(0x2e1b2138, 0x5c26c926), new Int_64(0x4d2c6dfc, 0x5ac42aed), new Int_64(0x53380d13, 0x9d95b3df), new Int_64(0x650a7354, 0x8baf63de), new Int_64(0x766a0abb, 0x3c77b2a8), new Int_64(0x81c2c92e, 0x47edaee6), new Int_64(0x92722c85, 0x1482353b), new Int_64(0xa2bfe8a1, 0x4cf10364), new Int_64(0xa81a664b, 0xbc423001), new Int_64(0xc24b8b70, 0xd0f89791), new Int_64(0xc76c51a3, 0x0654be30), new Int_64(0xd192e819, 0xd6ef5218), new Int_64(0xd6990624, 0x5565a910), new Int_64(0xf40e3585, 0x5771202a), new Int_64(0x106aa070, 0x32bbd1b8), new Int_64(0x19a4c116, 0xb8d2d0c8), new Int_64(0x1e376c08, 0x5141ab53), new Int_64(0x2748774c, 0xdf8eeb99), new Int_64(0x34b0bcb5, 0xe19b48a8), new Int_64(0x391c0cb3, 0xc5c95a63), new Int_64(0x4ed8aa4a, 0xe3418acb), new Int_64(0x5b9cca4f, 0x7763e373), new Int_64(0x682e6ff3, 0xd6b2b8a3), new Int_64(0x748f82ee, 0x5defb2fc), new Int_64(0x78a5636f, 0x43172f60), new Int_64(0x84c87814, 0xa1f0ab72), new Int_64(0x8cc70208, 0x1a6439ec), new Int_64(0x90befffa, 0x23631e28), new Int_64(0xa4506ceb, 0xde82bde9), new Int_64(0xbef9a3f7, 0xb2c67915), new Int_64(0xc67178f2, 0xe372532b), new Int_64(0xca273ece, 0xea26619c), new Int_64(0xd186b8c7, 0x21c0c207), new Int_64(0xeada7dd6, 0xcde0eb1e), new Int_64(0xf57d4f7f, 0xee6ed178), new Int_64(0x06f067aa, 0x72176fba), new Int_64(0x0a637dc5, 0xa2c898a6), new Int_64(0x113f9804, 0xbef90dae), new Int_64(0x1b710b35, 0x131c471b), new Int_64(0x28db77f5, 0x23047d84), new Int_64(0x32caab7b, 0x40c72493), new Int_64(0x3c9ebe0a, 0x15c9bebc), new Int_64(0x431d67c4, 0x9c100d4c), new Int_64(0x4cc5d4be, 0xcb3e42b6), new Int_64(0x597f299c, 0xfc657e2a), new Int_64(0x5fcb6fab, 0x3ad6faec), new Int_64(0x6c44198c, 0x4a475817) ];

// Append '1' at the end of the binary string message[messageLen >> 5] |= 0x80 << (24 - messageLen % 32); // Append length of binary string in the position such that the new length is correct message[lengthPosition] = messageLen;

// Figure out what to do with the key based on its size relative to // the hash's block size if (blockByteSize < (keyBinLen / 8)) { if ("SHA-1" === variant) { keyToUse = coreSHA1(keyToUse, keyBinLen); } else { keyToUse = coreSHA2(keyToUse, keyBinLen, variant); } // For all variants, the block size is bigger than the output size // so there will never be a useful byte at the end of the string keyToUse[lastArrayIndex] &= 0xFFFFFF00; } else if (blockByteSize > (keyBinLen / 8)) { // If the blockByteSize is greater than the key length, there will // always be at LEAST one "useless" byte at the end of the string keyToUse[lastArrayIndex] &= 0xFFFFFF00; }

Thursday, July 9, 2009

In the IT era that we live today, developers sometimes put in interesting functionality in the software they make.There are many such across the software that you use.One of them is in excel.You would need Excel 2000 for this.

But you access this from an Excel workbook saved as an interactive web page. If you have excel 2000 there are good chances that other two are also present. Just give it a try.

Steps

1. Open a new Excel workbook. 2. Select File * Save as Web Page 3. In the Save As dialog, select 'Publish Sheet' and 'Add Interactivity' 4. Save to an htm file on your hard drive (any file name). 5. Open the htm file with Internet Explorer. 6. Scroll to the cell WC2000 and then scroll the sheet such that cell "WC2000" is the first cell on the left. Now Highlight the entire row by clicking on the row number of the left edge. 7. Press Crtl+Alt+Shift and click the Office logo in the upper-left corner. 8. Your screen will be transformed into an auto racing game, with developer credits visible on the roadway.

Tips

* Use the following keys for the game: * Arrow keys: to steer and accelerate * Space bar: To fire at other cars * O: To drop oil slicks * H: To turn on/off your headlights (toggle switch). * Have fun, happy racing... * This probably works in Excel 2000, but it can't be assured that this will work in other versions of Excel.

Sunday, March 29, 2009

If you use Joomla, if you forget your admin username or password, you can change it easily with a simple MySQL query. The most convenient way to manage the database is through the phpMyAdmin tool. Go to your cPanel and click on phpMyAdmin in the Databases box. (If you are not using cPanel or do not have phpMyAdmin, you can run the query directly for Joomla's database.)

Once in the phpMyAdmin select the Joomla's database from the drop-down menu at left. The page will refresh and the database's tables will be displayed on it. Open the SQL tab (look at the top navigation bar).