This file contains 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 json | |
english_json = open('english.json', 'r').read() | |
frequencies_english = json.loads(english_json) | |
frequencies_english_sorted = [] | |
for char in sorted(frequencies_english, key=frequencies_english.get, reverse=True): | |
frequencies_english_sorted.append({'char': char, 'frq': frequencies_english[char]}) | |
This file contains 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 generate(code): | |
code_obj = compile(code, '<string>', 'exec') | |
code_ = code_obj.co_code | |
code = '' | |
for char in code_: | |
code += 'chr(' + str(hex(ord(char))) + ')+' | |
code = code[:-1] | |
return "type(make_secure)(code=type(make_secure.__code__)(%d,%d,%d,%d,%s,%s,%s,%s,'%s','%s',%d,'%s'),globals={})()" % (code_obj.co_argcount, code_obj.co_nlocals, code_obj.co_stacksize, code_obj.co_flags, code, str(code_obj.co_consts).replace(' ', ''), str(code_obj.co_names).replace(' ', ''), str(code_obj.co_varnames).replace(' ', ''), code_obj.co_filename, code_obj.co_name, code_obj.co_firstlineno, str(code_obj.co_lnotab)) | |
if __name__ == "__main__": |
This file contains 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 index(request): | |
if request.method == 'POST': | |
post_mutable = request.post.copy() | |
# Now you can change values: | |
post_mutable['answer'] = 42 |
This file contains 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
$(function() { | |
$('input[type="password"]') | |
.each(function() { | |
var that = this; | |
$(this).after($('<input>') | |
.attr('type', 'checkbox') | |
.click(function() { | |
that.type = (that.type === 'password' ? 'text' : 'password'); | |
}) | |
.after($('<span>')) |
This file contains 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
BLUWXTSBMSBZVXUWZMSRWLUAZMUXZKNARSZMNHBWWRABZMA | |
AKTVWSRALRAYUWTVYLRQVKTZYLTWYJMZQRYLMGAVVQZAYLZ | |
ZJSUVRQZKQZXTVSUXKQPUJSYXKSVXILYPQXKLFZUUPYZXKY | |
YIRTUQPYJPYWSURTWJPOTIRXWJRUWHKXOPWJKEYTTOXYWJX | |
XHQSTPOXIOXVRTQSVIONSHQWVIQTVGJWNOVIJDXSSNWXVIW | |
WGPRSONWHNWUQSPRUHNMRGPVUHPSUFIVMNUHICWRRMVWUHV | |
VFOQRNMVGMVTPROQTGMLQFOUTGORTEHULMTGHBVQQLUVTGU | |
UENPQMLUFLUSOQNPSFLKPENTSFNQSDGTKLSFGAUPPKTUSFT | |
TDMOPLKTEKTRNPMOREKJODMSREMPRCFSJKREFZTOOJSTRES | |
SCLNOKJSDJSQMOLNQDJINCLRQDLOQBERIJQDEYSNNIRSQDR |
This file contains 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 | |
def find_inverse(a, mod): # uses the euklid algorithm to calculate the | |
# modular inverse of a mod mod | |
original_mod, before_mod = mod, mod | |
qs = [] | |
while mod != 0: | |
if mod != before_mod: # skip 1st run | |
qs.insert(0, int(math.floor(a / mod))) # prepend rather than |
This file contains 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 decrypt(crypted, key): | |
plaintext = '' | |
chars = crypted.split(' ') | |
keys = key.split(' ') | |
if len(chars) != len(keys): | |
raise ValueError | |
plaintext = ''.join([chr(int(char, 16) ^ int(key, 16)) for char, key in zip(chars, keys)]) | |
return plaintext |
This file contains 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
<?php | |
function otp($text, $key) { | |
$text_chunks = explode(' ', $text); | |
$key_chunks = explode(' ', $key); | |
for($i = 0; $i < count($text_chunks); $i++) { | |
echo chr(hexdec($text_chunks[$i]) ^ hexdec($key_chunks[$i])); | |
} | |
} | |
otp('1C 07 7F 6F A7 86 A6 E9 E5 75 78 A9 73 B9 17 2F D6 00 25 9F B4 86 16 07 4D 07 0F 98 0F AB 0F 6C 11 10 0F 34 21 FD 2D 69 B3 0D 7F 21 96 3C', '4F 4E 3A 4F F4 C5 EE A0 A0 26 2B EC 3D 99 53 66 93 20 67 CD FD C3 50 54 0E 4F 4E DE 5B EE 41 4C 55 45 5D 77 69 DD 68 20 FD 2D 2D 6E DE 6E'); |
This file contains 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 random | |
from sbox import FakeBinary | |
class IP: | |
def __init__(self): | |
self.ip = [ | |
58,50,42,34,26,18,10,2, | |
60,52,44,36,28,20,12,4, | |
62,54,46,38,30,22,14,6, |
This file contains 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
alias subl="'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'" | |
alias nano="subl" | |
export EDITOR="subl" | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
export WORKON_HOME=$HOME/.virtualenvs | |
export PROJECT_HOME=$HOME/Projects/productgang | |
source /usr/local/bin/virtualenvwrapper.sh |
OlderNewer