Skip to content

Instantly share code, notes, and snippets.

@rdragos
rdragos / Fake-Offline.cpp
Created April 20, 2023 07:53
File used to generate fake offline data
#include "Math/gf2n.h"
#include "Math/gfp.h"
#include "Math/Share.h"
#include "Math/Setup.h"
#include "Auth/fake-stuff.h"
#include "Exceptions/Exceptions.h"
#include "Math/Setup.h"
#include "Processor/Data_Files.h"
@rdragos
rdragos / aes-no-opt.py
Created April 20, 2023 07:47
AES file with no optimizations for MPC evaluation with lookup tables
from copy import copy
import sys
rcon = [
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39,
0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,
@rdragos
rdragos / test_aes.py
Created April 20, 2023 07:45
AES file used for benchmarks for lookup tables
from copy import copy
import sys
rcon = [
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39,
0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,
@rdragos
rdragos / set_tc.sh
Last active January 19, 2021 17:51
dev=eth0
#dev=enp0s31f6
# 50ms latency (+/- 0.5ms), 50mbps bandwidth
# so applying this on both diffie + hellman gives latency of 100+/-1ms
sudo tc qdisc add dev $dev root handle 1: htb default 12
sudo tc class add dev $dev parent 1: classid 1:12 htb rate 50mbit ceil 50mbit
sudo tc qdisc add dev $dev parent 1:12 netem delay 50ms 1ms distribution normal
# unset_tc
# sudo tc qdisc del dev $dev root
@rdragos
rdragos / times 2
Created October 3, 2019 22:22
scale times 2
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 0 of event 'sched:sched_stat_sleep'
# Event count (approx.): 0
#
# Children Self Trace output
# ........ ........ ............
@rdragos
rdragos / estimator.py
Last active January 14, 2019 10:50
Cipher rounds
bit_length = 128
import sys
from math import ceil, log
kShark = False
#num_branches = int(sys.argv[1])
lan_throughputs = {
2: 15000.0
}
(!!) http://bioinformatics.oxfordjournals.org/content/30/24/3515.short
http://bioinformatics.oxfordjournals.org/content/31/4/509.abstract
HTSEQ(kind of hard) http://bioinformatics.oxfordjournals.org/content/31/2/166.abstract
(https://bitbucket.org/biocommons/hgvs/ - pretty decent)http://bioinformatics.oxfordjournals.org/content/31/2/268.abstract
(big data script) http://bioinformatics.oxfordjournals.org/content/31/1/10.abstract
Acceleration of short and long DNA read mapping without loss of accuracy using suffix array:
http://bioinformatics.oxfordjournals.org/content/30/23/3396.abstract
@rdragos
rdragos / New Level
Last active December 23, 2015 09:47
http://www.infoarena.ro/problema/substr
http://www.infoarena.ro/problema/pod
http://www.infoarena.ro/problema/scoici
http://www.infoarena.ro/problema/parpal
Equal partition Given a set A of 40 real numbers, find out if there is any way to split A in two sets such that the sums of their elements are equal
smenul de la stramosi
*
http://www.infoarena.ro/problema/log
http://www.infoarena.ro/problema/subsiruri2
@rdragos
rdragos / DP - Info
Last active August 29, 2015 14:13
DP - Info O clock
Edit distance (http://en.wikipedia.org/wiki/Edit_distance)
http://codeforces.com/problemset/problem/461/B
Problema XOR:
http://codeforces.com/gym/100402/attachments/download/2296/20082009-summer-petrozavodsk-camp-andrew-stankevich-contest-32-asc-32-en.pdf
http://www.infoarena.ro/problema/ratphu
Grafuri:
Semestrul 2:
@rdragos
rdragos / gist:f93de4ce5f592207541d
Last active August 29, 2015 14:11
Saptamana 6
K, F: http://codeforces.com/gym/100402/attachments/download/2296/20082009-summer-petrozavodsk-camp-andrew-stankevich-contest-32-asc-32-en.pdf
http://www.infoarena.ro/problema/g2mm
http://codeforces.com/contest/459/problem/C
Given a sequence of up to 300 '('s and ')'s, your task is to find the number of its different subsequences that are regular brackets sequences. For example, the sequence “((())())(” has 8 such subsequences: “((())())”, “(())()”, “((()))”, “(()())”, “(())”, “()()”, “()”, and “”.
http://codeforces.com/contest/448/problem/D