summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Turek <brian.turek@gmail.com>2015-03-08 14:22:23 -0400
committerBrian Turek <brian.turek@gmail.com>2015-03-08 14:22:23 -0400
commitfdf8409c56c8d7df92c60111909a77aaef268b58 (patch)
treeb753f89acfc191b68946dd792e87616c55d7ec4c
parent6ffb30c1fdaf49a09748a82a580f4e6b0041eb1c (diff)
downloadjsSHA-fdf8409c56c8d7df92c60111909a77aaef268b58.zip
jsSHA-fdf8409c56c8d7df92c60111909a77aaef268b58.tar.gz
jsSHA-fdf8409c56c8d7df92c60111909a77aaef268b58.tar.bz2
Postponing ASCII removal until v2.0
-rw-r--r--src/sha_dev.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/sha_dev.js b/src/sha_dev.js
index cc8a222..34ab870 100644
--- a/src/sha_dev.js
+++ b/src/sha_dev.js
@@ -1177,7 +1177,8 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
* @constructor
* @this {jsSHA}
* @param {string} srcString The string to be hashed
- * @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES
+ * @param {string} inputFormat The format of srcString, HEX, ASCII, TEXT,
+ * B64, or BYTES
* @param {string=} encoding The text encoding to use to encode the source
* string
*/
@@ -1203,7 +1204,7 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
strBinLen = srcConvertRet["binLen"];
strToHash = srcConvertRet["value"];
}
- else if ("TEXT" === inputFormat)
+ else if (("TEXT" === inputFormat) || ("ASCII" === inputFormat))
{
srcConvertRet = str2binb(srcString, utfType);
strBinLen = srcConvertRet["binLen"];
@@ -1223,7 +1224,7 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
}
else
{
- throw "inputFormat must be HEX, TEXT, B64, or BYTES";
+ throw "inputFormat must be HEX, TEXT, ASCII, B64, or BYTES";
}
/**
@@ -1337,7 +1338,8 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
*
* @expose
* @param {string} key The key used to calculate the HMAC
- * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES
+ * @param {string} inputFormat The format of key, HEX, TEXT, ASCII,
+ * B64, or BYTES
* @param {string} variant The desired SHA variant (SHA-1, SHA-224,
* SHA-256, SHA-384, or SHA-512)
* @param {string} outputFormat The desired output formatting
@@ -1408,7 +1410,7 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
keyBinLen = keyConvertRet["binLen"];
keyToUse = keyConvertRet["value"];
}
- else if ("TEXT" === inputFormat)
+ else if (("TEXT" === inputFormat) || ("ASCII" === inputFormat))
{
keyConvertRet = str2binb(key, utfType);
keyBinLen = keyConvertRet["binLen"];
@@ -1428,7 +1430,7 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
}
else
{
- throw "inputFormat must be HEX, TEXT, B64, or BYTES";
+ throw "inputFormat must be HEX, TEXT, ASCII, B64, or BYTES";
}
/* These are used multiple times, calculate and store them */