Join us in Outworldz at www.outworldz.com:9000 or follow us:
Want to add a script or a project? Upload it and a half million people will see it and your name here this year.
|Encryption||Contributors // // * Nekow42 Zarf (nekow42ATgmail.com) // * Strife Onizuka -- Combined Library // * Nardok Corrimal -- Memory optimization and help with the hex2byte function // // License // // This work is licensed under a Creative Commons Attribution 3.0 Unported License // // You are free: // // * to Share — to copy, distribute and transmit the work // * to Remix — to adapt the work // // Under the following conditions // // * Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). // // 1. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. // 2. Any of the above conditions can be waived if you get permission from the copyright holder. // 3. Nothing in this license impairs or restricts the author's moral rights. // // Disclaimer // // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // Documentation // // The same password can be used more than once, but the nonce always has to be different. (something random). You can use this to secure inter-object communication by having a shared (but secret) password, and have the two objects exchange a nonce beforehand. A warning, there is no garbage fitering, so the state array could be polluted by someone injecting fake strings. To prevent this, the first thing exchanged encrypted could be a negative port number, and the two objects could listen only for each other's key. For proper decryption, messages must arrive in the exact order they were encrypted. // // The key setup is very slow, but encryption itself is quite fast. // // Note: The EncryptText() and DecryptText() functions are NOT compatible. They CANNOT be used in the same script. // About ARCFOUR // // ARCFOUR (also known by the trademarked name RC4) is the most popular stream cipher still in use today. It was invented in 1987 by Ron Rivest of RSA Security. It is used in high security protocals such as Secure Sockets Layer (SSL). // // ARCFOUR works by creating a pseudorandom stream of bits, and then XORing that stream with the plaintext to produce the ciphertext. Since it operates in this manner, the same identical key should never be used twice. This implementation works to prevent that by adding a nonce to the end of the key. // About this implementation // // This implementation of ARCFOUR performs 128-bit encryption. It uses the MD5sum of the password and the nonce to prevent all known related key attacks against ARCFOUR. // // Each script contains two functions. One to set up the key, and another to perform the actual encryption and decryption. Additional calls to the encrypt or decrypt function will continue to encrypt with the same key stream. // // To encrypt, call the following functions: // // KeySetup(string password, string nonce) // string EncryptText(string plaintext) // // The nonce should be a randomly generated string and should only be used once. // // This will return a hex string. // // To decrypt, call the following functions: // // KeySetup(string password, string nonce) // string DecryptText(string ciphertext) // // using the same nonce. // Changes // Version 1.3 // // * Corrected typecasting error. Anyone using this script prior to 2009-08-22 MUST update their copy to address this issue. // // Version 1.2 // // * Outputs to Hex instead of a CSV of bytes // // Version 1.1 // // * Hashes the key and the nonce with MD5, as per the RSA Laboratories suggestion. This prevents all related key attacks against ARCFOUR. // * Memory optimizations // // Version 1.0 // // * Initial Release // // Future Recommendations // // * Support UTF-8 // * By version 2.0, have a full protocol with automatic nonce generation, exchange, and object key filtering.|
|Encryption||Test Vectors for ARCFOUR // // Test vectors are from RC4 Summary // // This vectors are not official, but are handy for anyone testing an ARCFOUR implementation. // // RC4( "Key", "Plaintext" ) == BBF316E8D940AF0AD3 // // In decimal, the output is "187, 243, 22, 232, 217, 64, 175, 10, 211" // // This code shows that it passes the test vector:|
Back to the Best Free Tools in Second Life and OpenSim.