chore: format everything

This commit is contained in:
canove
2025-05-06 12:10:19 -03:00
parent 04afa20244
commit fa706d0b50
76 changed files with 8241 additions and 7142 deletions

View File

@@ -9,7 +9,6 @@ import { hkdf } from './crypto'
const o = 128
class d {
salt: string
constructor(e: string) {
@@ -17,7 +16,7 @@ class d {
}
add(e, t) {
var r = this
for(const item of t) {
for (const item of t) {
e = r._addSingle(e, item)
}
@@ -25,7 +24,7 @@ class d {
}
subtract(e, t) {
var r = this
for(const item of t) {
for (const item of t) {
e = r._subtractSingle(e, item)
}
@@ -38,20 +37,20 @@ class d {
async _addSingle(e, t) {
var r = this
const n = new Uint8Array(await hkdf(Buffer.from(t), o, { info: r.salt })).buffer
return r.performPointwiseWithOverflow(await e, n, ((e, t) => e + t))
return r.performPointwiseWithOverflow(await e, n, (e, t) => e + t)
}
async _subtractSingle(e, t) {
var r = this
const n = new Uint8Array(await hkdf(Buffer.from(t), o, { info: r.salt })).buffer
return r.performPointwiseWithOverflow(await e, n, ((e, t) => e - t))
return r.performPointwiseWithOverflow(await e, n, (e, t) => e - t)
}
performPointwiseWithOverflow(e, t, r) {
const n = new DataView(e)
, i = new DataView(t)
, a = new ArrayBuffer(n.byteLength)
, s = new DataView(a)
for(let e = 0; e < n.byteLength; e += 2) {
const n = new DataView(e),
i = new DataView(t),
a = new ArrayBuffer(n.byteLength),
s = new DataView(a)
for (let e = 0; e < n.byteLength; e += 2) {
s.setUint16(e, r(n.getUint16(e, !0), i.getUint16(e, !0)), !0)
}