Skip to content

Instantly share code, notes, and snippets.

View gromgit's full-sized avatar
💭
🤔 🤣

Adrian Ho gromgit

💭
🤔 🤣
  • Singapore
View GitHub Profile
@gromgit
gromgit / pa_serial_test.c
Created November 27, 2017 13:43
PackedArray serialization test
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "PackedArray.h"
/*
PackedArray serialization test
BUILD:
1. Grab PackedArray.[ch] from https://github.com/gpakosz/PackedArray, drop them in this dir
@gromgit
gromgit / test-keyspace.c
Last active November 14, 2017 03:06
AES-256 keyspace collision threshold calculator
// OBJECTIVE: Find the smallest ASCII-only password length guaranteed to
// trigger KDF collisions for AES-256
// TEST 1 (binary ASCII): Find the smallest N for which:
// 2^7 + 2^14 + 2^21 + ... + 2^(7*N) > 2^256
// TEST 2 (printable ASCII): Find the smallest N for which:
// 95^1 + 95^2 + 95^3 + ... + 95^N > 2^256
// TEST 3 (alphanumeric ASCII): Find the smallest N for which:
// 62^1 + 62^2 + 62^3 + ... + 62^N > 2^256
// COMPILE:
// gcc -o test-keyspace test-keyspace.c -lgmp
@gromgit
gromgit / kore_mavericks.diff
Created August 5, 2016 04:05
Kore compatibility patch for macOS <= Mavericks
*** kore-2.0.0/src/pool.c.orig Fri Aug 5 10:21:29 2016
--- kore-2.0.0/src/pool.c Fri Aug 5 11:04:37 2016
***************
*** 21,26 ****
--- 21,35 ----
#include "kore.h"
+ // FIX: macOS <= Mavericks doesn't define MAP_ANONYMOUS
+ #ifndef MAP_ANONYMOUS