Skip to content

Instantly share code, notes, and snippets.

View raullenchai's full-sized avatar
🎯
Focusing

Raullen Chai raullenchai

🎯
Focusing
View GitHub Profile
@raullenchai
raullenchai / linearc.c
Created July 2, 2012 17:45
A toy example of linear cryptnalaysis applying to a simple SPN cipher
#include <stdio.h>
#include <math.h>
/*
A toy example of linear cryptnalaysis applying to a simple SPN cipher: y = f[f[f[x]^K1]^K2]^...]^Kn, where f is a composition of "S" and "P" selected freely.
*/
@raullenchai
raullenchai / TimeLockPuzzle.py
Created July 3, 2012 19:23
Python implementation of Rivest's Time-lock Puzzles
'''
Python implementation of Rivest's Time-lock Puzzles as described
here: http://people.csail.mit.edu/rivest/lcs35-puzzle-description.txt
'''
import time
def GenPuzzle(t, p, q):
n = p*q
@raullenchai
raullenchai / tornado-nginx-example.conf
Created July 5, 2012 16:47 — forked from didip/tornado-nginx-example.conf
Nginx config example for Tornado
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
@raullenchai
raullenchai / CTC.py
Created July 12, 2012 20:36
Python Implementation of Courtois Toy Cipher (CTC)
'''
Python Implementation of Courtois Toy Cipher (CTC)
CTC is a toy cipher presented for sake of cryptanalysis using algebraic attacks in http://eprint.iacr.org/2006/168.pdf.
'''
def xorRoundKey(state,roundkey):
return state ^ roundkey
@raullenchai
raullenchai / compare_dir.py
Created November 28, 2012 20:46
Compare the lay out of dir1 and dir2, ignore the content of files
import os
def compare_dir_layout(dir1, dir2):
def _compare_dir_layout(dir1, dir2):
for (dirpath, dirnames, filenames) in os.walk(dir1):
for filename in filenames:
relative_path = dirpath.replace(dir1, "")
if os.path.exists( dir2 + relative_path + '\\' + filename) == False:
print relative_path, filename
return
@raullenchai
raullenchai / asdsad.py
Created December 18, 2012 19:40
asadasdasd
asdasd
zxczxcxzc
#include <iostream>
using namespace std;
int* insertion_sort(int A[], int size){
if (size<=0 || A == NULL)
return A;
int key;
for(int i=1; i<size; ++i){
@raullenchai
raullenchai / LBlock.py
Created February 20, 2013 21:55
POC implementation of LBlock Cipher (http://eprint.iacr.org/2011/345.pdf)
"""
POC implementation of LBlock Cipher (http://eprint.iacr.org/2011/345.pdf)
Uncompatible with Test Vectors given in the paper
"""
s0 = [14, 9, 15, 0, 13, 4, 10, 11, 1, 2, 8, 3, 7, 6, 12, 5]
s1 = [4, 11, 14, 9, 15, 13, 0, 10, 7, 12, 5, 6, 2, 8, 1, 3]
s2 = [1, 14, 7, 12, 15, 13, 0, 6, 11, 5, 9, 3, 2, 4, 8, 10]
s3 = [7, 6, 8, 11, 0, 15, 3, 14, 9, 10, 12, 13, 5, 2, 4, 1]
s4 = [14, 5, 15, 0, 7, 2, 12, 13, 1, 8, 4, 9, 11, 10, 6, 3]
@raullenchai
raullenchai / go.py
Last active December 15, 2015 07:19
Dump raw reuters in nltk into a csv -- compatible with Mallet's Topic Modeling
from nltk.corpus import reuters
mylist = reuters.fileids()
f = open('myfile','w')
for text in mylist:
something = text + '\t'
for cat in reuters.categories(text):
something += cat + " "
something += '\t' + reuters.raw(text).replace('\n', '') + '\n'
#print something
@raullenchai
raullenchai / install.sh
Last active December 29, 2015 17:59
cpuminer install
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm make git-core -y
git clone https://github.com/pooler/cpuminer.git
cd cpuminer
./autogen.sh
./configure CFLAGS="-O3"
make
# start the miner
./minerd --url=your.minerpool.org --user=username --pass=password