Skip to content

Instantly share code, notes, and snippets.

@inaz2
inaz2 / pollardRho.go
Last active April 15, 2023 09:22
Pollard-rho algorithm in Golang and math/big
View pollardRho.go
$ go version
go version go1.20.3 linux/amd64
$ go build -ldflags="-s -w" -trimpath pollardRho.go
$ time ./pollardRho 12814570762777948741
12814570762777948741 = 3861801803 * 3318288047
real 0m0.032s
user 0m0.024s
sys 0m0.005s
@inaz2
inaz2 / Cargo.toml
Last active April 15, 2023 09:18
Pollard-rho algorithm in Rust and num-bigint
View Cargo.toml
[package]
name = "pollard_rho"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
num-bigint = { version = "0.4.3", features = ["rand"] }
num-integer = "0.1.45"
@inaz2
inaz2 / comparison.md
Created March 19, 2023 18:04
Comparison of Python type-checkers
View comparison.md

Test code

from typing import List
import requests

def ident(x):
    return x

def add_1(x):
View definitelytyped.ts
interface T<V> { valueOf(): V }
type HECK<V> = V extends T<infer R> ? T<R> : never
type P = string | number | boolean | null | undefined
type FXCK = { [k: string]: U }
type SXIT = (...args: U[]) => U | void
type U = U[] | FXCK | SXIT | P | HECK<any>
let fxck: U
fxck = {}; console.log(fxck) // FXCK | T<unknown>
fxck = []; console.log(fxck) // U[] | T<unknown>
@inaz2
inaz2 / squfof.py
Last active January 5, 2023 12:42
SQUFOF algorithm (Shanks's square forms factorization)
View squfof.py
$ time python3 squfof.py 60766145992321225002169406923
60766145992321225002169406923 = 242950340194949 * 250117558771727
real 0m23.864s
user 0m23.850s
sys 0m0.008s
@inaz2
inaz2 / brent_pollard_rho.py
Last active January 4, 2023 17:23
Pollard Rho and Brent-Pollard Rho factoring algorithm
View brent_pollard_rho.py
# brent_pollard_rho.py
import sys
import gmpy2
from random import randint
from math import gcd
def miller_rabin(n, k=20):
s, d = 0, n-1
@inaz2
inaz2 / strassen_factor.py
Last active January 4, 2023 17:22
Strassen’s factoring algorithm
View strassen_factor.py
$ time python3 strassen_factor.py 12814570762777948741
12814570762777948741 = 3318288047 * 3861801803
real 1m17.824s
user 1m17.800s
sys 0m0.012s
$ time python3 strassen_factor.py 18366865165381711817
18366865165381711817 is prime
@inaz2
inaz2 / install_qira.sh
Last active June 19, 2022 03:25
installing QIRA on Ubuntu 20.04 LTS
View install_qira.sh
$ uname -a
Linux vm-ubuntu 5.13.0-48-generic #54~20.04.1-Ubuntu SMP Thu Jun 2 23:37:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
@inaz2
inaz2 / CLSID_Windows10EnterpriseEvaluation_10.0.19041.csv
Last active November 30, 2021 11:21
default CLSID/IID list (Windows 10 Enterprise Evaluation 10.0.19041)
View CLSID_Windows10EnterpriseEvaluation_10.0.19041.csv
We can't make this file beautiful and searchable because it's too large.
"Registry path","CLSID","(default)","AppID","ProgID","InprocServer32"
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\CLSID","CLSID","{0000031A-0000-0000-C000-000000000046}","","",""
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0000002F-0000-0000-C000-000000000046}","{0000002F-0000-0000-C000-000000000046}","CLSID_RecordInfo","","","C:\Windows\System32\oleaut32.dll"
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000300-0000-0000-C000-000000000046}","{00000300-0000-0000-C000-000000000046}","StdOleLink","","","combase.dll"
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000301-A8F2-4877-BA0A-FD2B6645FB94}","{00000301-A8F2-4877-BA0A-FD2B6645FB94}","PSFactoryBuffer","","","C:\Windows\system32\windowscodecs.dll"
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000303-0000-0000-C000-000000000046}","{00000303-0000-0000-C000-000000000046}","FileMoniker","","file","combase.dll"
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000304-0000-0000-C000-000000000046}","{00000304-0000-0000-C000-000000000046}","ItemMoniker","","","comb
@inaz2
inaz2 / Source.cpp
Created June 3, 2017 08:44
use-after-free on Low Fragmentation Heap (without /SDL, Windows 10, Visual Studio 2015)
View Source.cpp
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <stdio.h>
class Cat {
char name[0x20];
public:
virtual void cry() { puts("meow"); };
};