mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 20:16:33 +02:00
Big linting
This commit is contained in:
parent
b5e6d049ce
commit
aef6bd3d59
58 changed files with 2074 additions and 1856 deletions
44
lib/hash.js
44
lib/hash.js
|
@ -4,7 +4,7 @@
|
|||
(function(){
|
||||
"use strict";
|
||||
|
||||
var scope;
|
||||
let scope;
|
||||
if ((typeof exports) !== "undefined"){
|
||||
scope = exports;
|
||||
}
|
||||
|
@ -20,11 +20,11 @@
|
|||
};
|
||||
|
||||
scope.sumXor = function(inputByteArray){
|
||||
var hash = new Uint32Array(4);
|
||||
var sum = new Float64Array(hash.buffer, 8, 1);
|
||||
var intView = new Uint32Array(inputByteArray.buffer);
|
||||
var floatView = new Float32Array(inputByteArray.buffer);
|
||||
var length = intView.length;
|
||||
const hash = new Uint32Array(4);
|
||||
// const sum = new Float64Array(hash.buffer, 8, 1);
|
||||
const intView = new Uint32Array(inputByteArray.buffer);
|
||||
// const floatView = new Float32Array(inputByteArray.buffer);
|
||||
const length = intView.length;
|
||||
for (let i = 0; i < length; i += 1){
|
||||
// sum[0] += floatView[i];
|
||||
hash[0] ^= intView[i];
|
||||
|
@ -34,11 +34,11 @@
|
|||
};
|
||||
|
||||
scope.hashCode = function(inputByteArray){
|
||||
var hash = new Uint32Array(1);
|
||||
var intView = new Uint32Array(inputByteArray.buffer);
|
||||
var length = intView.length;
|
||||
const hash = new Uint32Array(1);
|
||||
const intView = new Uint32Array(inputByteArray.buffer);
|
||||
const length = intView.length;
|
||||
for (let i = 0; i < length; i += 1){
|
||||
var v = hash[0];
|
||||
const v = hash[0];
|
||||
hash[0] = ((v << 5) - v) + intView[i];
|
||||
}
|
||||
return hash;
|
||||
|
@ -81,21 +81,21 @@
|
|||
return function md5(inputByteArray){
|
||||
h.set(hInitial);
|
||||
|
||||
var length = inputByteArray.buffer.byteLength;
|
||||
var messageBitLength = length * 8;
|
||||
const length = inputByteArray.buffer.byteLength;
|
||||
const messageBitLength = length * 8;
|
||||
|
||||
// create byte array with length dividable by 64 (512 bit)
|
||||
var neededLength = Math.ceil((length + 1 + 8) / 64) * 64;
|
||||
var messageByteArray = new Uint8Array(neededLength);
|
||||
const neededLength = Math.ceil((length + 1 + 8) / 64) * 64;
|
||||
const messageByteArray = new Uint8Array(neededLength);
|
||||
messageByteArray.set(new Uint8Array(inputByteArray.buffer));
|
||||
var view = new DataView(messageByteArray.buffer);
|
||||
const view = new DataView(messageByteArray.buffer);
|
||||
|
||||
// append 10...000000
|
||||
messageByteArray[length] = 0x80;
|
||||
// append size in 64 bit big endian
|
||||
view.setUint32(neededLength - 8, messageBitLength, true);
|
||||
|
||||
for (var i = 0; i < neededLength; i += 64){
|
||||
for (let i = 0; i < neededLength; i += 64){
|
||||
for (let j = 0; j < 64; j += 4){
|
||||
w[j / 4] = view.getUint32(i + j, true);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@
|
|||
temp[4] = (temp[2] ^ (temp[1] | (~ temp[3])));
|
||||
temp[5] = (7*j) % 16;
|
||||
}
|
||||
var temp_ = temp[3];
|
||||
const temp_ = temp[3];
|
||||
temp[3] = temp[2];
|
||||
temp[2] = temp[1];
|
||||
temp[1] = (leftRotate(temp[0] + temp[4] + k[j] + w[temp[5]], r[j]) + temp[1]);
|
||||
|
@ -165,14 +165,14 @@
|
|||
|
||||
h.set(hInitial);
|
||||
|
||||
var length = inputByteArray.buffer.byteLength;
|
||||
var messageBitLength = length * 8;
|
||||
const length = inputByteArray.buffer.byteLength;
|
||||
const messageBitLength = length * 8;
|
||||
|
||||
// create byte array with length dividable by 64 (512 bit)
|
||||
var neededLength = Math.ceil((length + 1 + 8) / 64) * 64;
|
||||
var messageByteArray = new Uint8Array(neededLength);
|
||||
const neededLength = Math.ceil((length + 1 + 8) / 64) * 64;
|
||||
const messageByteArray = new Uint8Array(neededLength);
|
||||
messageByteArray.set(new Uint8Array(inputByteArray.buffer));
|
||||
var view = new DataView(messageByteArray.buffer);
|
||||
const view = new DataView(messageByteArray.buffer);
|
||||
|
||||
// append 10...000000
|
||||
messageByteArray[length] = 0x80;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue