Skip to content

Instantly share code, notes, and snippets.

View mimoo's full-sized avatar
🦀
求同存异

David Wong mimoo

🦀
求同存异
View GitHub Profile
@mimoo
mimoo / gist:8e5d80a2e236b8b6f5ed
Created January 27, 2016 23:06
Mersenne Twister test vectors
seed: 1131464071
3521569528
1101990581
1076301704
2948418163
3792022443
2697495705
2002445460
502890592
@mimoo
mimoo / test.sage
Last active February 5, 2016 17:53
check new socat's dh2048_p
# socat's new dh params
dh2048_p = 0x00dc216456bd9cb2acbec998ef953e26fab557bcd9e675c043a21c7a85df34ab57a8f6bcf6847d056904834cd556d385090a08ffb537a1a38a370446d2933196f4e40d9fbd3e7f9e4daf08e2e8039473c4dc0687bb6dae662d181fd847065ccf8ab50051579bea1ed8db8e3c1fd32fba1f5f3d15c13b2c8242c88c87795b38863aebfd81a9baf7265b93c53e03304b005cb6233eea94c3b471c76e643bf89265ad606cd47ba9672604a80ab206ebe07d90ddddf5cfb4117cabc1a384be2777c7de20576647a735fe0d6a1c52b858bf2633815eb7a9c0ee581174861908891c370d524770758ba88b3011713662f07341ee349d0a2b674e6aa3e299921bf5327363
dh2048_g = 2
# is_prime(dh2048_p) -> True
q = (dh2048_p - 1) / 2
print is_prime(q) # -> False
@mimoo
mimoo / .tmux.conf
Last active July 12, 2019 18:08
Tmux config
# binds
unbind C-b
set -g prefix C-z
bind C-z send-prefix
#
# Theme (Solarized 256)
#
# default statusbar colors
@mimoo
mimoo / Babai_for_CVP.tex
Last active March 29, 2016 17:37
contributions for Tikz for cryptographers
\begin{tikzpicture}
\begin{scope}[scale=.28,local bounding box=scope1]
\coordinate (Origin) at (0,0);
\coordinate (XAxisMin) at (-1,0);
\coordinate (XAxisMax) at (10,0);
\coordinate (YAxisMin) at (0,-1);
\coordinate (YAxisMax) at (0,10);
\draw [thin, black!40, <->] (XAxisMin) -- (XAxisMax);% Draw x axis
@mimoo
mimoo / linear_approx_table.py
Last active April 13, 2024 09:02
calculate linear approximation tables for Sboxes
import sys
# sbox from the tutorial
#sbox = [0xe, 4, 0xd, 1, 2, 0xf, 0xb, 8, 3, 0xa, 6, 0xc, 5, 9, 0, 7]
sbox = [0xf, 3, 0xa, 6, 4, 1, 0xb, 9, 0xe, 5, 0, 0xd, 2, 0xc, 7, 8]
SIZE_SBOX = len(sbox)
# compute the linear approximation for a given "input = output" equation
def linearApprox(input_int, output_int):
total = 0
@mimoo
mimoo / list.md
Created September 5, 2016 16:53
couch coop/gaming

So far we've really enjoyed:

  • speedrunners
  • towerfall
  • blazerush

fun:

  • lovers in a dangerous spacetime
  • overcooked
@mimoo
mimoo / subscriptions.xml
Created September 5, 2016 20:15
RSS subscriptions
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions of David Wong</title>
</head>
<body>
<outline text="little man in my head" title="" type="rss" xmlUrl="https://littlemaninmyhead.wordpress.com/feed/" htmlUrl="https://littlemaninmyhead.wordpress.com/"/>
<outline text="...And You Will Know me by the Trail of Bits" title="...And You Will Know me by the Trail of Bits" type="rss" xmlUrl="http://blog.trailofbits.com/feed/" htmlUrl="http://blog.trailofbits.com/"/>
<outline text="A Few Thoughts on Cryptographic Engineering" title="A Few Thoughts on Cryptographic Engineering" type="rss" xmlUrl="http://blog.cryptographyengineering.com/feeds/posts/default" htmlUrl="http://blog.cryptographyengineering.com/"/>
<outline text="Aaron Toponce" title="Aaron Toponce" type="rss" xmlUrl="https://pthree.org/feed/" htmlUrl="https://pthree.org/"/>
@mimoo
mimoo / whitelist.go
Last active March 14, 2017 21:14
Whitelist of state transitions for TLS 1.3
//
// Server Messages
//
// after server.server_hello
(server.server_hello, server.encrypted_extensions)
// after server.hello_retry_request)
(server.hello_retry_request, client.client_hello)
@mimoo
mimoo / aes.sage
Created January 27, 2017 11:57
differential characteristic of the aes sbox
S = mq.SBox([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc
@mimoo
mimoo / get_stats_on_branch.sh
Created February 21, 2017 19:27
Get stats on what files were most commited to on a branch.
git log --first-parent --no-merges --stat branch_name ce2137c155a379.. | grep +++++++ | sed 's/\+//g' | sed 's/\-//g' | sed 's/|//g' | awk '{arr[$1]+=$2} END {for (i in arr) {print i,arr[i]}}' | sort -k 2 -n -r | column -t > ../stats
# replace:
# branch_name -> the name of the branch you want to get the stats from
# ce2137c155a379 -> the first commit of the branch (or the commit you want to lower bound your stats with)