kopia lustrzana https://github.com/jackfagner/NfcKey
Bug fix
rodzic
e78b93ecb9
commit
fb71ea3198
|
@ -82,8 +82,8 @@ NfcKey.prototype = (function () {
|
||||||
|
|
||||||
var tohex = function (b, l) {
|
var tohex = function (b, l) {
|
||||||
var h = b.toString(16).toUpperCase();
|
var h = b.toString(16).toUpperCase();
|
||||||
if (h.length % 2 !== 0)
|
while (l && h.length < l / 4)
|
||||||
return '0' + h;
|
h = '0' + h;
|
||||||
return h;
|
return h;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ NfcKey.prototype = (function () {
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
intKey = transfUid[i + offset] + ((intKey << 8) >>> 0);
|
intKey = transfUid[i + offset] + ((intKey << 8) >>> 0);
|
||||||
|
|
||||||
return tohex(swap32(intKey));
|
return tohex(swap32(intKey), 32);
|
||||||
},
|
},
|
||||||
|
|
||||||
getPack: function (uid) {
|
getPack: function (uid) {
|
||||||
|
@ -128,7 +128,7 @@ NfcKey.prototype = (function () {
|
||||||
intPack += transfUid[i] * 13;
|
intPack += transfUid[i] * 13;
|
||||||
|
|
||||||
var res = ((intPack ^ 0x5555) >>> 0) & 0xFFFF;
|
var res = ((intPack ^ 0x5555) >>> 0) & 0xFFFF;
|
||||||
return tohex(swap16(res));
|
return tohex(swap16(res), 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue