{{ message }}

Instantly share code, notes, and snippets.

# Niklas Baumstark niklasb

Created Mar 26, 2014
View Code Golf SE Aristoteles
 #include using namespace std; #define R(i,e)for(I i=1;i
Created Oct 23, 2014
keybase.md
View keybase.md

### Keybase proof

I hereby claim:

• I am niklasb on github.
• I am nba (https://keybase.io/nba) on keybase.
• I have a public key whose fingerprint is EFA9 7C96 C0CD 9721 101F 5D67 7784 A6C0 F0BD 08CF

To claim this, I am signing this object:

Created Dec 26, 2014
View wtfregexp.py
 import random f = open("wtfregexp.pl", "r") reg = f.readlines()[0] reg = reg[reg.index('/')+1:-3] clauses = [] maxi = 0 for l in reg.split(','): l = l[3:-1].replace("[01]", ".")
Last active Aug 29, 2015
View pubkey_laptop
Created Feb 11, 2015
View pubkey_macbook
Created Apr 20, 2015
Solution for 'lazy' in PlaidCTF 2015
View lazy.sage
 from ast import literal_eval ciphertext = int(open("ciphertext.txt", 'rb').read()) pubkey = literal_eval(open("pubkey.txt", 'rb').read()) def mat(pubkey, ciphertext, B): n = len(pubkey) A = Matrix(ZZ,n+1,n+1) for i in range(n): A[i,i] = 1
Created Jul 6, 2015
bitonic sort
View bitonic.cpp
 #include #include using namespace std; void make_leq(int& a, int& b) { if (a > b) swap(a,b); } void bitonic(vector& xs) { int n = xs.size();
Last active Sep 1, 2015
Monolog handler for Slack's (new?) incoming webooks
View MonologSlackHandler.php
 class MonologSlackHandler extends \Monolog\Handler\MailHandler { protected \$hook_url; protected \$channel; protected \$username; protected \$icon; /** * @param string \$hook_url The URL of your incoming web hook (e.g. * https://hooks.slack.com/services/\$token) * @param string \$channel Slack channel to post in (with leading # sign)
Created Sep 13, 2015
LCGsign
View signer2.py
 # from https://github.com/ctfs/write-ups-2015/tree/master/mma-ctf-2015/crypto/LCG-sign-400 from Crypto.Util.number import * from hashlib import sha256 import random import sys import key p = 267336782497463360204553349940982883027638137556242083062698936408269688347005688891456763746542347101087588816598516438470521580823690287174602955234443428763823316700034360179480125173290116352018408224011457777828019316565914911469044306734393178495267664516045383245055214352730843748251826260401437050527 q = 133668391248731680102276674970491441513819068778121041531349468204134844173502844445728381873271173550543794408299258219235260790411845143587301477617221714381911658350017180089740062586645058176009204112005728888914009658282957455734522153367196589247633832258022691622527607176365421874125913130200718525263 g = 2
Created Sep 28, 2015
View rsolve.sage
 def rsolve(coeff, values, rhs=0, nonhom_sol=0): R. = CC[] f = 0 for i, c in enumerate(coeff): f += c * x**i h = 0 n = var('n') cs = [] cnt = 0