Skip to content

Commit

Permalink
Merge branch 'qistoph-HmacToggleStr'
Browse files Browse the repository at this point in the history
  • Loading branch information
n1474335 committed Nov 7, 2018
2 parents 520eaed + 8bcf68c commit 5eb7e00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/core/operations/HMAC.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class HMAC extends Operation {
this.args = [
{
"name": "Key",
"type": "binaryString",
"value": ""
"type": "toggleString",
"value": "",
"toggleValues": ["Hex", "Decimal", "Base64", "UTF8", "Latin1"]
},
{
"name": "Hashing function",
Expand Down Expand Up @@ -66,7 +67,7 @@ class HMAC extends Operation {
* @returns {string}
*/
run(input, args) {
const key = args[0],
const key = Utils.convertToByteString(args[0].string || "", args[0].option),
hashFunc = args[1].toLowerCase(),
msg = Utils.arrayBufferToStr(input, false),
hasher = CryptoApi.getHasher(hashFunc);
Expand Down
2 changes: 1 addition & 1 deletion test/tests/operations/Hash.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "HMAC",
"args": ["test", "SHA256"]
"args": [{"option": "Latin1", "string": "test"}, "SHA256"]
}
]
},
Expand Down

0 comments on commit 5eb7e00

Please sign in to comment.