I want implement hash funkcion fore create SHA-1 SHA-2 MDP from string
There is implemented SAH-1 hash but this does not work.
it is implemented in utils.js by this funkcion:
/**
* This method calculates the one-way hash of an input string, and returns the hash.
* This method is used to calculate the one-way hash of an input string, which can then be used to ensure that strings are not modified,
* for anonymization, or for any other purpose for which hashes are useful.
* At this time, the only supported hash algorithm is SHA-1, but parameters are supplied for future extensions.
* @example
* var string="This is my messge.";
* var hash=string.hash();
* @addon
* @param {String} format Output format for the hash ('HEX' or 'B64' for hex (default) and base64, respectively)
* @param {String} algo Algorithm to be used to calculate the hash value ('SHA-1' is the default, and only supported method at this time)
* @return {String} A string representing the hash value calculated from the source string.
*/
String.prototype.hash = function(format, algo) {
if (typeof format == "undefined" || format != "B64") { format = "HEX"; }
algo = "SHA-1";
var hashobj = new jsSHA(this, "ASCII"); // UTF-8?
return hashobj.getHash(format);
// return hashobj.getHash(algo, format); // reserved for future extensions
};
But this does not work it cannot find jsSHA
My question if somebody know:
- What engine is use for interpret java script in Sentinel
- How it is include java script from directory (How it is implemented " load, include ... does not work")
./current/sdk/2011.1/common/
to work together.
- There is jsSHA implementation in file sha1.js
- I want to fix hash function to work and add future extension for ssh-2
Thx.