GM_cryptoHash

erikvold edited this page Dec 27, 2011 · 5 revisions

Description

GM_cryptoHash takes in a string and returns a cryptographic hash (using nsICryptoHash).

Arguments

String aString

A string of data to be hashed.

String aAlgorithm

Optional. The hash algorithm to be used. Possible values are: MD2, MD5, SHA1, SHA256, SHA384, and SHA512. Defaults to SHA1.

String aCharset

Optional. The charset used by the passed string. Defaults to UTF-8.

Returns

String

Examples

var myStr = "Yay!";
GM_log("SHA1 hash of " + myStr + ": " + GM_cryptoHash(myStr));
GM_log("MD5 hash of " + myStr + ": " + GM_cryptoHash(myStr, "MD5"));

Related Pages

Manual: API