Skip to content

Instantly share code, notes, and snippets.

View sivachandran's full-sized avatar

Sivachandran sivachandran

View GitHub Profile
@sivachandran
sivachandran / bin2h.cmake
Last active December 7, 2023 22:19
Pure CMake function to convert any file into C/C++ header, implemented with only CMake commands.
include(CMakeParseArguments)
# Function to wrap a given string into multiple lines at the given column position.
# Parameters:
# VARIABLE - The name of the CMake variable holding the string.
# AT_COLUMN - The column position at which string will be wrapped.
function(WRAP_STRING)
set(oneValueArgs VARIABLE AT_COLUMN)
cmake_parse_arguments(WRAP_STRING "${options}" "${oneValueArgs}" "" ${ARGN})
@sivachandran
sivachandran / RSA_padding_add_PKCS1_OAEP_SHA512.c
Created July 7, 2014 16:45
RSA PKCS1 OAEP padding with SHA512 algorithm
static int MGF1_SHA512(unsigned char *mask, long len, const unsigned char *seed, long seedlen)
{
return PKCS1_MGF1(mask, len, seed, seedlen, EVP_sha512());
}
static int RSA_padding_add_PKCS1_OAEP_SHA512(unsigned char *to, int tlen,
const unsigned char *from, int flen,
const unsigned char *param, int plen)
{
int i, emlen = tlen - 1;
@sivachandran
sivachandran / SimpleTcpRedirector.py
Created March 4, 2012 01:42
A simple TCP redirector in python
#!/usr/bin/env python
import socket
import threading
import select
import sys
terminateAll = False
class ClientThread(threading.Thread):