Skip to content

Instantly share code, notes, and snippets.

💭
🤔 🤣

Adrian Ho gromgit

💭
🤔 🤣
  • Singapore
View GitHub Profile
@gromgit
gromgit / dump_bcrypt_hash.c
Created May 30, 2018
Dump salt and digest of bcrypt hash
View dump_bcrypt_hash.c
// Original src: https://github.com/pyca/bcrypt/blob/master/src/_csrc/bcrypt.c
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
// Maps to character set "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
static const u_int8_t index_64[128] = {
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
@gromgit
gromgit / pa_serial_test.c
Created Nov 27, 2017
PackedArray serialization test
View pa_serial_test.c
#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 Nov 14, 2017
AES-256 keyspace collision threshold calculator
View test-keyspace.c
// 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 Aug 5, 2016
Kore compatibility patch for macOS <= Mavericks
View kore_mavericks.diff
*** 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
You can’t perform that action at this time.