diff --git a/firefox_addon/lib/hmac.js b/firefox_addon/lib/hmac.js
index a70525d..257c39a 100644
--- a/firefox_addon/lib/hmac.js
+++ b/firefox_addon/lib/hmac.js
@@ -22,19 +22,21 @@ var {Cc, Ci} = require("chrome");
var hmac = Cc["@mozilla.org/security/hmac;1"]
.createInstance(Ci.nsICryptoHMAC);
-function hmac_init(key) {
- var keyObject = Cc["@mozilla.org/security/keyobjectfactory;1"]
- .getService(Ci.nsIKeyObjectFactory)
- .keyFromString(Ci.nsIKeyObject.HMAC, key);
- hmac.init(hmac.SHA256, keyObject);
-}
+exports.hmac = {
+ hmac_init : function (key) {
+ var keyObject = Cc["@mozilla.org/security/keyobjectfactory;1"]
+ .getService(Ci.nsIKeyObjectFactory)
+ .keyFromString(Ci.nsIKeyObject.HMAC, key);
+ hmac.init(hmac.SHA256, keyObject);
+ },
-function hmac_digest(message) {
- var data = new Uint8Array(message.length);
- for(i=0; i.
*/
-require("hmac.js");
+var hmac = require("hmac.js").hmac;
exports.pkdbf2 = {
@@ -28,10 +28,10 @@ exports.pkdbf2 = {
var temp_res = "";
var temp_res2 = "";
- hmac_init(password);
+ hmac.hmac_init(password);
for (i=1; result.length < outlen; i++)
{
- temp = hmac_digest(salt +
+ temp = hmac.hmac_digest(salt +
String.fromCharCode((i & 0xff000000) >> 24) +
String.fromCharCode((i & 0x00ff0000) >> 16) +
String.fromCharCode((i & 0x0000ff00) >> 8) +
@@ -41,7 +41,7 @@ exports.pkdbf2 = {
for(a=1; a