Skip to content

Instantly share code, notes, and snippets.

View randombit's full-sized avatar

Jack Lloyd randombit

View GitHub Profile
@randombit
randombit / gitconfig
Created June 4, 2024 12:50
Git pull GH PRs
[remote "origin"]
url = git@github.com:randombit/foo.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
/**
Minimization of https://github.com/randombit/botan/issues/3637
*/
#define CAUSE_CODEGEN_BUG
#include <stdint.h>
#include <stdlib.h>
#include <type_traits>
#include <cstring>
@randombit
randombit / argon2_bench.cpp
Created March 4, 2022 13:03
Benchmark of libargon2
#include <argon2.h>
#include <stdint.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
uint64_t timestamp()
{
struct timespec ts;
if(::clock_gettime(CLOCK_MONOTONIC_RAW, &ts) == 0)
via https://twitter.com/mjos_crypto/status/1219610073816801286
Cloned https://github.com/daniel-thompson/pinebook-pro-debian-installer/
Inserted a 32GB sdcard into the built-in slot.
./install-debian
Installs the a system there, reboot from sdcard.
Clone again, now do:
./install-debian CRYPT=y BLKDEV=/dev/mmcblk2
Answer questions, done!
Supafresh Debian with LUKS on PineBook Pro.
@randombit
randombit / seccomp.c
Created January 14, 2019 18:41
Apply seccomp filters
void apply_simple_seccomp_filter(const std::vector<std::string>& allowed_syscalls)
{
//scmp_filter_ctx seccomp_ctx = ::seccomp_init(SCMP_ACT_ERRNO(EPERM));
scmp_filter_ctx seccomp_ctx = ::seccomp_init(SCMP_ACT_TRAP);
if(seccomp_ctx == NULL)
throw std::runtime_error("seccomp_init failed");
for(std::string syscall : allowed_syscalls)
{
int syscall_num = ::seccomp_syscall_resolve_name(syscall.c_str());
@randombit
randombit / gen_wordpress_secrets.py
Created November 27, 2018 15:51
Generate secrets for wordpress
#!/usr/bin/python
import os
import binascii
keys = [
'AUTH_KEY',
'SECURE_AUTH_KEY',
'LOGGED_IN_KEY',
'NONCE_KEY',
@randombit
randombit / rsa_sign.py
Created November 21, 2018 16:24
Threshold 2-of-2 RSA signatures
#!/usr/bin/python
from fractions import gcd
import random
def lcm(a,b):
return (a*b)//gcd(a,b)
def egcd(a, b):
if a == 0:
@randombit
randombit / packages
Last active May 23, 2022 13:45
Arch package list
After installing, add:
Useful
--------
vim
emacs-nox
net-tools
tmux
tcpdump
nmap
@randombit
randombit / dsa_groups.txt
Created August 2, 2018 16:34
DSA groups generated by lexicographical first working seed
P=1024 Q=160
Seed=000000000000000000000000000000000000021
-----BEGIN X9.42 DH PARAMETERS-----
MIIBHwKBgQCEoKuNbWMqbPuFOqSWKMGJyQ8VMSWLMtQ80wj0Is3RxrGpz0Bpshd7
Q9EL7BVjwTi+bZe68bXwU8GsHNLq6qplevvfsmpeHaJn0vt/gHRjmWWB68phAuPe
+CcU9X4ESl8e869AkSq3rnCnpTHauBDMkOWvXiMRUNEE5QbPdNHlhQKBgQCBrdzE
HRHk662S9/WZnuZpAeZjQCZZug1DToG97W4Z9xOycttPZ50N5mC4+NOhmfV4t3a+
1wTe7vuYdL8zHt/dcIx9ow/uriqlaFX2Hh/jTYeC8r0m1JDcBxKV21aE5QLqpCfu
Jr8h/76s55aY1m2OWaR1K//y54GWZ4sxoxgS8gIVANnk4S2TxAhgZKmIVOksz0sn
dNlL
@randombit
randombit / format_ecdsa.py
Created May 31, 2018 21:15
Format Wycheproof ECDSA test data
!/usr/bin/python
import json
import hashlib
import binascii
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.type.univ import Sequence
from pyasn1.type.univ import Integer
from pyasn1.type.namedtype import NamedTypes
from pyasn1.type.namedtype import NamedType