Skip to content

Instantly share code, notes, and snippets.

View anthonyclays's full-sized avatar

Anthony Clays anthonyclays

  • Leuven, Belgium
View GitHub Profile
@anthonyclays
anthonyclays / break_caesar.jl
Last active August 29, 2015 14:20
Fully automated caesar rotation decryption using a 2D language entropy table
#!/usr/bin/env julia
const ENTROPY_MAP_2D = open("entropy.csv") do f
readdlm(f, ',')
end
# Returns index 1:26 for a-z, 27 for space
function get_index_for(ch)
if 'a' <= ch <= 'z'
return int(ch - 96)
@anthonyclays
anthonyclays / curious.jl
Last active August 29, 2015 14:19
Curious solution
#!/usr/bin/env julia
# Adapted from https://github.com/pablocelayes/rsa-wiener-attack
using ContinuedFractions # Note: this needs my fork of ContinuedFractions.jl
# fast perfect square test (from project euler tools)
# returns -1 if n is not a perfect square
function perfect_square(n::Integer)
h = n & 0xF # last four bits
#!/usr/bin/env julia
using CRC
# crc computing function
const handler = crc(CRC_32)
# offsets of IDAT chunks (points to 'I' byte)
const offsets = [114,131197,262278,393361,524445,655526,786609,917691,1048775,1179858,1188429]
# correct crcs. No 0x0a in those so we can assume they're correct ;)
const crcs = [0xf55a745d, 0x06e15ebf, 0xa0bdc18a, 0xadefb326, 0x09c557f7,
#!/usr/bin/env perl
<>;
foreach(<>){
s/(ij|[aeiou]+)p\1/\1/ig;
print;
}
#!/usr/bin/env perl
for (my $N=<>; $N; $N--){
$_ = "";
for (my $L=<>; $L; $L--) {
$_ .= <>;
}
for (my $L=<>; $L; $L--) {
my ($n, $r) = split(' ', <>);
s/($r( |$){$n}/\1/gm;