U64
DivPow10(U64 a, S64 index)
{
ASSERT(index >= 0 && index < 19);
// Generated using libdivide's reference implementation adapted to 64-bit unsigned integers.
static const struct { U64 mul; U32 shr1; U32 shr2; } kPow10Magics[19] = {
{ 0xcccccccccccccccd, 0, 3 }, // 10^1
{ 0x28f5c28f5c28f5c3, 2, 2 }, // 10^2
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
import zlib | |
import struct | |
def export_skn(path, data): | |
head = data[:20] | |
reserve = data[20:20+256] # 未知数据,全为0,大小是256,可能是给文件头扩容保留的 | |
body = data[20+256:] | |
sign, version, size = struct.unpack('<04sQQ', head) | |
if sign!=b'FSPQ': |
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
# ____ ____ | |
# / __/___ / __/ | |
# / /_/_ / / /_ | |
# / __/ / /_/ __/ | |
# /_/ /___/_/ key-bindings.zsh | |
# | |
# - $FZF_TMUX_OPTS | |
# - $FZF_CTRL_T_COMMAND | |
# - $FZF_CTRL_T_OPTS | |
# - $FZF_CTRL_R_OPTS |
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 <windows.h> | |
#include <psapi.h> | |
#include <stdio.h> | |
#include <string> | |
#include <vector> | |
std::string store_password; | |
std::wstring QuoteSpaceIfNeeded(const std::wstring &str) | |
{ |
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 tinyec import registry | |
import secrets | |
def compress(pubKey): | |
return hex(pubKey.x) + hex(pubKey.y)[2:] | |
curve = registry.get_curve('secp256r1') |
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
# 已知n和phi求p q | |
from sympy import symbols, solve | |
n = 1141574900469012067636252180723835763151920736282470632700965427450254174708499891391924201142298374181693031433288816864153023177804715482450166860015258287506501285068163017195211966134698458111181058182005585938681465830111118867709096243399041372276386809721333892464112085735367452600541715292290079220522270815111077388426606567096816463177229069700881806969035414147663217609196771833717652147248133905228806566277089964340350926709132880091484440081291867 | |
phi = 1141574900469012067636252180723835763151920736282470632700965427450254174708499891391924201142298374181693031433288816864153023177804715482450166860015258165887575210803576766535149248650990306655744681050265422300794686668511098707335740896061248758188315389043730123141479632359506080499922725994127962549611715479724233268459284756489870354300620746588895051518136083710196648747569108450588260775600203396574920477102242310852948444452793222038768500472297680 | |
p, q = symbols("p,q") | |
eq1 = p * q - |
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 sympy import isprime | |
N = "ED4C27A0C3E6C655D9FAE2AFBFC913A134C1732DB806E1AD21EC97E46A3206F8B1B62DAF2B709A27ECFAF46D5FC0C2398820F2A8E09A45321E69D2929BD6324FCF8D6CEE887E153DBB4DF83E3DDCF7AB5741A48DB627D894FEC949F1FB47490CF60B75D102CC63D2A899D8135155D4A2BA599AC6F882B8F622CD61965A9389734BE8BC519A94DD46F3824D24D720B649F9CDB11A7CE4AA3C1498C7E971BC886B3BC1888B5F42B1981FDF51E1CB9699FDF78A0EF2ABE43BC763D2C692F1C5B119B5448B04E29ED88C584E38D9B899CC6C30583593BABAE8FA01AFE40314DA2AFBCA1D83CF3E614E9CB8CE4F097046F0FBD306084DBD3B2E14F1006952DF646B3B" | |
N = bytearray(bytes.fromhex(N)) | |
print(N.hex()) | |
ok = False | |
for j in range(len(N)): |
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 pathlib import Path | |
from natsort import natsorted | |
from PIL import Image | |
folder = Path("sheep") | |
files = [] | |
for file_path in folder.glob("*.png"): | |
if file_path.is_file(): | |
files.append(file_path) |
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
import hashlib | |
# /hashcat.bin -a 0 -m 17225 "\$pkzip2\$1*2*2*0*18*c*48479f6*0*44*0*18*0484*0e2f*fb0202f54a4db131a41afa5ad61932a447318711893011e9*\$/pkzip2\$" words.txt --show | |
def calculate_md5(data): | |
md5_hash = hashlib.md5() | |
md5_hash.update(data) | |
return md5_hash.hexdigest() |
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 pyzbar.pyzbar import decode | |
from PIL import Image | |
for i in range(1, 38): | |
x = decode(Image.open('{}.png'.format(i))) | |
print(x[0].data.decode(), end="") | |
# break |
OlderNewer