home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 26: Security / pc_actual_seguridad.iso / Encriptacion / XORcrypt 1.1 / EXAMPLE.JS next >
Encoding:
Text File  |  2001-09-30  |  596 b   |  11 lines

  1. //  This example demonstrates the process of XOR encryption and decription.
  2. //  Symbol "a" - source, symbol "3"- key
  3. //  "a" XOR "3" = "R"    i.e. "R" - encrypted "a" with XOR key "3"
  4. //  For decryption we do:
  5. //  "R" XOR "3" = "a"    
  6. //
  7. //                                           a                 XOR 3                 =R
  8. WScript.echo("a ^ 3 ="+String.fromCharCode( "a".charCodeAt(0)  ^  "3".charCodeAt(0)));
  9. //                                           R                 XOR 3                 =a
  10. WScript.echo("R ^ 3 ="+String.fromCharCode( "R".charCodeAt(0)  ^  "3".charCodeAt(0)));
  11.