From 4066aa6ad1662eed75a43f39d2aaf715b032864f Mon Sep 17 00:00:00 2001 From: Gavin Zyonse Date: Tue, 21 Feb 2023 17:35:55 -0500 Subject: [PATCH 1/2] Fix variable names --- content.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content.js b/content.js index 02a8128..539a809 100644 --- a/content.js +++ b/content.js @@ -146,7 +146,7 @@ if (window.location.href.startsWith("https://www.purdue.edu/apps/account/cas/log localStorage.removeItem("pin"); localStorage.removeItem("code"); localStorage.removeItem("username"); - localStorage.removeItem("count"); + localStorage.removeItem("counter"); localStorage.removeItem("hotpSecret"); //Get the user's info to setup a new BoilerKey askForInfo(); @@ -156,7 +156,7 @@ if (window.location.href.startsWith("https://www.purdue.edu/apps/account/cas/log localStorage.removeItem("pin"); localStorage.removeItem("code"); localStorage.removeItem("username"); - localStorage.removeItem("count"); + localStorage.removeItem("counter"); localStorage.removeItem("hotpSecret"); //Get the user's info to setup a new BoilerKey askForInfo(); From 866081e29d9e505d5eb08e26675ccf698a424fba Mon Sep 17 00:00:00 2001 From: Zyonse Date: Tue, 21 Feb 2023 18:45:56 -0500 Subject: [PATCH 2/2] jsOTP: Change counter format to HEX --- jsOTP.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jsOTP.js b/jsOTP.js index 33783e6..f14f2b2 100644 --- a/jsOTP.js +++ b/jsOTP.js @@ -94,10 +94,11 @@ } getOtp(key, counter) { - var digest, h, offset, shaObj, v; - shaObj = new jsSHA("SHA-1", "TEXT"); + var digest, h, offset, shaObj, v, counterString; + shaObj = new jsSHA("SHA-1", "HEX"); shaObj.setHMACKey(key, "TEXT"); - shaObj.update(this.uintToString(new Uint8Array(this.intToBytes(counter)))); + counterString = ("0000000000000000" + counter.toString(16)).slice(-16); // padded hex counter value + shaObj.update(counterString); digest = shaObj.getHMAC("HEX"); // Get byte array h = this.hexToBytes(digest);