Skip to content

Instantly share code, notes, and snippets.

import java.util.ArrayList;
// Stuff to remember:
// * ellipseMode -> can take CENTER to do what you expect
final int width = 600;
final int height = 600;
boolean[] primality;
final int scale = 5;
void setup() {
size(600, 600);
primality = sieve();
@ethan2-0
ethan2-0 / rc5EncryptionPseudocode.txt
Last active February 26, 2016 03:32
RC5 Encryption Pseudocode
for i = 1 to 2*n:
l = l xor r
l = l <<< r
l = l + K[i] % 2^64
(l, r) = (r, l) # Swap l and r
@ethan2-0
ethan2-0 / rc5DecryptionPseudocode.txt
Created February 26, 2016 03:34
RC5 Decryption Pseudocode
for i = 2*n to 1:
l = l - K % 2^64
l = l >>> r
l = l xor r
(l, r) = (r, l)
@ethan2-0
ethan2-0 / energydietrankings.txt
Last active April 17, 2016 17:54
Energy Diet Challenge video rankings
Generated Sun Apr 17 13:54:26 EDT 2016
1. (1275 votes) Room 11 Lumley
2. (1173 votes) Pulsifer Grade 4
3. (1162 votes) 6 Van den Eynden
4. (988 votes) GRADE 5 LAGO AZUL
5. (860 votes) Whitney Wolves
6. (690 votes) The Green Team
7. (686 votes) NDC 3/4
8. (660 votes) Suzuki Student Success
9. (648 votes) Gillis Green Team
@ethan2-0
ethan2-0 / READMEmd
Created September 15, 2016 01:09
A 32-bit block cipher with a security reduction to a stream cipher
This provides a 32-bit block cipher based on four 16-bit pseudorandom functions,
precomputed based on the output of a stream cipher. To compute the `F_j(i)`,
the `j`th PRF evaluated at `i`, we take the two bytes starting at the
`(j * 2^16 + i) * 2`th byte of the output of the stream cipher. (This particular
implementation actually uses four distinct stream cipher output streams, and
uses `os.urandom()` in place of a stream cipher, but you get the idea.) These
four PRFs `F_0`, `F_1`, `F_2`, `F_3` are used as the F-functions of a four-round
Feistel network.
# Usage
@ethan2-0
ethan2-0 / README.md
Created September 27, 2016 02:15
A Python script to generate permutations of the set of 32-bit strings

This provides a 32-bit block cipher based on four 16-bit pseudorandom functions, precomputed based on the output of a stream cipher. To compute the F_j(i), the jth PRF evaluated at i, we take the two bytes starting at the (j * 2^16 + i) * 2th byte of the output of the stream cipher. (This particular implementation actually uses four distinct stream cipher output streams, and uses os.urandom() in place of a stream cipher, but you get the idea.) These four PRFs F_0, F_1, F_2, F_3 are used as the F-functions of a four-round Feistel network.

Usage

@ethan2-0
ethan2-0 / README.md
Last active August 1, 2020 02:54
A Python 3 libnetfilter_queue handler intended to mitigate CPU load covert channels based on ping timings

Usage

To install the dependencies, run the script install_deps.sh as root.

To set up the filter, run setup_iptables.sh as root. You may need to change the queue-num parameter if you already have some NFQUEUE-based iptables rules.

To run the filter, run python3 main.py as root. If you used a queue number other than 0, you'll need to pass it as the first parameter to main.py.

@ethan2-0
ethan2-0 / mandelbrot.py
Created July 22, 2015 20:37
Mandelbrot/Julia set in Processing/Python.
# IF YOU WANT A JULIA SET, SET isMandelbrot TO False.
# Copyright (c) 2015 Ethan White. Licensed under 3-clause BSD.
# Requires the Python mode for Processing.
import time
import math
# Fudge factors
startSize = (1000, 1000)
widthMultFudge = float(4)
heightMultFudge = float(4)
widthAddFudge = 10