nsISupports
Last changed in Gecko 1.9 (Firefox 3)ACString finish(in PRBool aASCII); |
void init(in unsigned long aAlgorithm, in nsIKeyObject aKeyObject); |
void reset(); |
void update([const, array, size_is(aLen)] in octet aData, in unsigned long aLen); |
void updateFromStream(in nsIInputStream aStream, in unsigned long aLen); |
Hashing Algorithms. These values are to be used by the init()
method to indicate which hashing function to use. These values map onto the values defined in mozilla/security/nss/lib/softoken/pkcs11t.h and are switched to CKM_*_HMAC constant.
Constant | Value | Description |
MD2 |
1 |
Message Digest Algorithm 2 |
MD5 |
2 |
Message-Digest algorithm 5 |
SHA1 |
3 |
Secure Hash Algorithm 1 |
SHA256 |
4 |
Secure Hash Algorithm 256 |
SHA384 |
5 |
Secure Hash Algorithm 384 |
SHA512 |
6 |
Secure Hash Algorithm 512 |
Completes this HMAC object and produces the actual HMAC diegest data.
init()
is called. This call resets the object to its pre-init state.ACString finish( in PRBool aASCII );
aASCII
true
then the returned value is a base-64 encoded string. if false
, then the returned value is binary data.A hash of the data that was read by this object. This can be either binary data or base 64 encoded.
NS_ERROR_NOT_INITIALIZED
init()
has not been called.Initialize the hashing object. This method may be called multiple times with different algorithm types.
void init( in unsigned long aAlgorithm, in nsIKeyObject aKeyObject );
aAlgorithm
aKeyObject
var keyObject = Components.classes["@mozilla.org/security/keyobjectfactory;1"] .getService(Components.interfaces.nsIKeyObjectFactory) .keyFromString(Components.interfaces.nsIKeyObject.HMAC, rawKeyData);
NS_ERROR_INVALID_ARG
Reinitialize HMAC context to be reused with the same settings (the key and hash algorithm) but on different set of data.
void reset();
None.
void update( [const, array, size_is(aLen)] in octet aData, in unsigned long aLen );
aData
aLen
aData
.NS_ERROR_NOT_INITIALIZED
init()
has not been called.Calculates and updates a new hash based on a given data stream.
void updateFromStream( in nsIInputStream aStream, in unsigned long aLen );
aStream
aLen
aStream
. Passing PR_UINT32_MAX indicates that all data available will be used to update the hash.NS_ERROR_NOT_INITIALIZED
init()
has not been called.NS_ERROR_NOT_AVAILABLE