Skip to content

Instantly share code, notes, and snippets.

View marfire's full-sized avatar

Kevin Christopher Henry marfire

View GitHub Profile
@defrex
defrex / print_request.py
Created January 20, 2015 22:01
A couple utility functions for pretty printing Django request and response objects
from __future__ import unicode_literals, print_function
import re
import colorama
header_regex = re.compile('^HTTP_')
def print_header(key, value):
@whatisaphone
whatisaphone / feistel.py
Created June 12, 2012 20:32
Unlimited length feistel cipher
import hashlib
class FeistelSHA1:
rounds = 4 # 4 rounds is sufficient as long as the round function is cryptographically secure
split = 1 / 2
def __init__(self, key, rounds=rounds):
self.subkeys = [hashlib.sha1(bytes((i,)) + key).digest() for i in range(rounds)]