This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timingSafeEqual(a, b) { | |
if (a.length !== b.length) return false; | |
let result = 0; | |
for (let i = 0; i < a.length; i++) { | |
result |= a[i] ^ b[i]; | |
} | |
return result === 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c796842c4aaaca1b640a1fd0e03c9d8e85f571c8 Mon Sep 17 00:00:00 2001 | |
From: rfl890 <87506407+rfl890@users.noreply.github.com> | |
Date: Wed, 24 Jan 2024 18:14:16 -0500 | |
Subject: [PATCH] Update PRNG | |
--- | |
src/lib_math.c | 2 +- | |
src/lj_prng.c | 43 ++++++++++++++++++++++--------------------- | |
2 files changed, 23 insertions(+), 22 deletions(-) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Change to the path of lua51.lib/libluajit-2.1.a/whatever LuaJIT library you link against | |
local lua_slib = "\"C:\\Users\\user\\bin\\luajit\\lib\\lua51.lib\"" | |
local CC = "clang -O2" | |
local stub_code = [[#include <lua.h> | |
#include <lauxlib.h> | |
#include <lualib.h> | |
#include <luajit.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lib_color = {} | |
-- Constants | |
lib_color.color_type = { TYPE_8 = 39710315, TYPE_256 = 34942623, TYPE_RGB = 29505187 } | |
local FOREGROUND = 1 | |
local BACKGROUND = 2 | |
local ESCAPE = "\x1b[" | |
local RESET = "\x1b[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <Windows.h> | |
#include <bcrypt.h> | |
#include <ntstatus.h> | |
#include <ntdef.h> | |
typedef struct SHA256State { | |
BCRYPT_ALG_HANDLE algHandle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
ffi.cdef[[ | |
struct _iobuf { | |
char *_ptr; | |
int _cnt; | |
char *_base; | |
int _flag; | |
int _file; | |
int _charbuf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wmmintrin.h> | |
#include <stdio.h> | |
#include <string.h> | |
static __m128i aes_256_key_expansion_1(__m128i key, | |
__m128i keygened) | |
{ | |
keygened = _mm_shuffle_epi32(keygened, _MM_SHUFFLE(3, 3, 3, 3)); | |
key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); | |
key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local BASE_O = ("lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o"):split(" ") | |
local LUA_AND_LUAC_O = ("lua.o luac.o"):split(" ") | |
local cc = "clang -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_BUILD_AS_DLL" | |
-- make .o | |
for _, object in pairs(BASE_O) do | |
local cFileName = object:sub(1, #object - 1) .. "c" | |
local command = cc .. " -c -o " .. object .. " " .. cFileName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Better emojis | |
// @namespace Violentmonkey Scripts | |
// @match *://*/* | |
// @grant none | |
// @version 1.0 | |
// @run-at document-end | |
// @author - | |
// @description Replaces the default emoji font on your device. Works with newer browsers (Chrome & Edge 98+, Firefox 107+, Opera 100+) | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findClosestBits(n) { | |
return BigInt('0b' + n.toString(2).replaceAll('0', '1')) | |
} | |
// Returns a uniform random value in [0, max) | |
function rand(max) { | |
if (max <= 0) throw new Error("Argument max must be > 0"); | |
if (max > 0xFFFFFFFFFFFFFFFFn) throw new Error("Argument max must be <= 0xFFFFFFFFFFFFFFFF"); | |
const randomNumber = new BigUint64Array(1); | |
crypto.getRandomValues(randomNumber); |
NewerOlder