Skip to content

Instantly share code, notes, and snippets.

@edhiley
edhiley / feistel.py
Created August 12, 2016 13:50 — forked from whatisaphone/feistel.py
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)]