Skip to content

Instantly share code, notes, and snippets.

View th0rex's full-sized avatar

Timo von Hartz th0rex

View GitHub Profile
@th0rex
th0rex / elgamal.py
Last active September 3, 2018 09:39
#!/usr/bin/env python
# -*- vim: set sts=4 sw=4 fdm=marker: -*-
# Please put in your name and id number here
# Name:
# Matrikelnummer:
from collections import defaultdict
from functools import reduce
#ifndef ALTERNATIVELINKEDLIST_H
#define ALTERNATIVELINKEDLIST_H
#include "Item.h"
#include "List.h"
/*
* Deklariert hier die AlternativeLinkedList ohne Dummy-Element.
*
* Diese Liste soll keine FreeList verwenden, denn die move-Methoden
def eea(r0, r1):
if r0 <= r1:
r0, r1 = r1, r0
r = [r0, r1, 0]
s = [1, 0, 0]
t = [0, 1, 0]
i = 2
// clang++ -std=c++17 baby_giant_step.cpp -o baby_giant_step -march=native -O3
// ./baby_giant_step
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <unordered_map>
#include <utility> // std::swap
struct result {
@th0rex
th0rex / gf_mul.py
Last active April 19, 2018 09:10
#!/usr/bin/python3
import functools
# 1+0x+x^2+0x^3+0x^4+x^5
p = [1, 0, 1, 0, 0, 1]
def format_polynom(xs):
return " + ".join(reversed([("x^{}".format(i) if i > 0 else "1") for i, x in enumerate(xs) if x == 1]))
#pragma once
#include <exception>
#include <variant>
#include <experimental/coroutine>
#include <experimental/net>
namespace ams::async {
using std::experimental::coroutine_handle;
namespace TriCore {
enum {
PHI = 0,
INLINEASM = 1,
CFI_INSTRUCTION = 2,
EH_LABEL = 3,
GC_LABEL = 4,
KILL = 5,
EXTRACT_SUBREG = 6,
INSERT_SUBREG = 7,
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
const uint32_t data[256] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
@th0rex
th0rex / config.tex
Created March 11, 2018 17:23
Some latex styles
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{minted}
\usepackage{xcolor}
\definecolor{background}{HTML}{1d1f21}
\definecolor{foreground}{HTML}{c5c8c6}
\definecolor{comment}{HTML}{969896}
@th0rex
th0rex / impl.cc
Last active February 18, 2018 19:14
algorithm thing
#include <algorithm>
#include <iostream>
#include <iterator>
#include <random>
#include <vector>
std::vector<unsigned> random_vec(const unsigned count) {
std::random_device rnd_device;
std::mt19937 mt(rnd_device());
std::uniform_int_distribution<unsigned> dist;