This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -e -f 'bruce_rsa_6e7ecd53b443a97013397b1a1ea30e14.pub' -m 'PKCS8' > bruce.pub | |
openssl rsa -pubin -in bruce.pub -noout -modulus | cut -d '=' -f2 | xargs echo "ibase=16; $1"| bc | tr -d '\' | tr -d '\n' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shift_rows(s): | |
s[0][1], s[1][1], s[2][1], s[3][1] = s[1][1], s[2][1], s[3][1], s[0][1] | |
s[0][2], s[1][2], s[2][2], s[3][2] = s[2][2], s[3][2], s[0][2], s[1][2] | |
s[0][3], s[1][3], s[2][3], s[3][3] = s[3][3], s[0][3], s[1][3], s[2][3] | |
def inv_shift_rows(s): | |
tmp = s[13] | |
s[13] = s[9] | |
s[9] = s[5] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pohligHellmanPGH(p,g,h): | |
#p is the modulus | |
#g is the argument (a) | |
#h is the equivalence class i.e the result of pow(g,e,p). e is what we are looking for | |
F=IntegerModRing(p) | |
g=F(g) | |
h=F(h) | |
G=[] | |
H=[] | |
X=[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from random import randint, seed | |
from time import time, process_time | |
import string | |
strchr = lambda x: chr(x) | |
strbyt = lambda x, y=0: ord(x[y]) | |
bitlst = lambda x, y: x << y | |
bitrst = lambda x, y: x >> y | |
bitext = lambda x, y, z=1: bitrst(x, y) & int(math.pow(2, z) - 1) |
OlderNewer