Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions dist/jsOTP-es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ var _createClass = function () { function defineProperties(target, props) { for
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

(function () {
var Hotp, Totp, global;

if (global === void 0 && window !== void 0) {
global = window;
}
var Hotp, Totp;

Totp = function () {
// pass in the secret, code dom element, ticker dom element
Expand Down Expand Up @@ -40,7 +36,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}, {
key: "base32tohex",
value: function base32tohex(base32) {
var base32chars, bits, chunk, hex, i, val;
var base32chars, bits, checklength, chunk, hex, i, val;
base32chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
bits = "";
hex = "";
Expand All @@ -50,8 +46,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
bits += this.leftpad(val.toString(2), 5, "0");
i++;
}
checklength = bits.length - bits.length % 8;
i = 0;
while (i + 4 <= bits.length) {
while (i + 4 <= checklength) {
chunk = bits.substr(i, 4);
hex = hex + parseInt(chunk, 2).toString(16);
i += 4;
Expand Down
2 changes: 1 addition & 1 deletion dist/jsOTP-es5.min.js

Large diffs are not rendered by default.

Binary file modified dist/jsOTP-es5.min.js.gz
Binary file not shown.
5 changes: 3 additions & 2 deletions dist/jsOTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

base32tohex(base32) {
var base32chars, bits, chunk, hex, i, val;
var base32chars, bits, checklength, chunk, hex, i, val;
base32chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
bits = "";
hex = "";
Expand All @@ -31,8 +31,9 @@
bits += this.leftpad(val.toString(2), 5, "0");
i++;
}
checklength = bits.length - bits.length % 8;
i = 0;
while (i + 4 <= bits.length) {
while (i + 4 <= checklength) {
chunk = bits.substr(i, 4);
hex = hex + parseInt(chunk, 2).toString(16);
i += 4;
Expand Down
2 changes: 1 addition & 1 deletion dist/jsOTP.min.js

Large diffs are not rendered by default.

Binary file modified dist/jsOTP.min.js.gz
Binary file not shown.
5 changes: 3 additions & 2 deletions js/jsOTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

base32tohex(base32) {
var base32chars, bits, chunk, hex, i, val;
var base32chars, bits, checklength, chunk, hex, i, val;
base32chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
bits = "";
hex = "";
Expand All @@ -31,8 +31,9 @@
bits += this.leftpad(val.toString(2), 5, "0");
i++;
}
checklength = bits.length - bits.length % 8;
i = 0;
while (i + 4 <= bits.length) {
while (i + 4 <= checklength) {
chunk = bits.substr(i, 4);
hex = hex + parseInt(chunk, 2).toString(16);
i += 4;
Expand Down