Bug fix in js file

pull/3/head
Jack 2017-11-22 20:56:54 +01:00 zatwierdzone przez GitHub
rodzic 22b80b7daf
commit 3c495f1df5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 11 dodań i 4 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 2017 github.com/jackfagner
This file is part of NfcKey.
@ -80,6 +80,13 @@ NfcKey.prototype = (function () {
| ((val >>> 24) & 0xFF)) >>> 0;
};
var tohex = function (b, l) {
var h = b.toString(16).toUpperCase();
if (h.length % 2 !== 0)
return '0' + h;
return h;
};
return {
constructor: NfcKey,
@ -101,7 +108,7 @@ NfcKey.prototype = (function () {
for (i = 0; i < 4; i++)
intKey = transfUid[i + offset] + ((intKey << 8) >>> 0);
return swap32(intKey).toString(16).toUpperCase();
return tohex(swap32(intKey));
},
getPack: function (uid) {
@ -121,8 +128,8 @@ NfcKey.prototype = (function () {
intPack += transfUid[i] * 13;
var res = ((intPack ^ 0x5555) >>> 0) & 0xFFFF;
return swap16(res).toString(16).toUpperCase();
return tohex(swap16(res));
}
};
})();
})();