Hello,
I need a Javascript tot calculate a SHA-1 hash.
Problem is: I have no knowledge in this aresa. Please tell me how to accomplish that the script uses a session.variable for input and how I get the output into another session.variable.
I need a Javascript tot calculate a SHA-1 hash.
Problem is: I have no knowledge in this aresa. Please tell me how to accomplish that the script uses a session.variable for input and how I get the output into another session.variable.
Code:
<!-- Java script for SHA-1 calculation --> <!-- Session.__Protected__SHAString contains the string to be hashed ('msg' in the Javascript) --> <!-- Session.__protected__SHAHash must contain the resulting hash from the script (the returned string) --> <script type="text/javascript"> /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* SHA-1 implementation in JavaScript | (c) Chris Veness 2002-2010 | www.movable-type.co.uk */ /* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */ /* http://csrc.nist.gov/groups/ST/toolkit/examples.html */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ var Sha1 = {}; // Sha1 namespace /** * Generates SHA-1 hash of string * * @param {String} msg String to be hashed * @param {Boolean} [utf8encode=true] Encode msg as UTF-8 before generating hash * @returns {String} Hash of msg as hex character string */ Sha1.hash = function(msg, utf8encode) { ... the script itself...
Comment