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
R=IntegerModRing(2**32) | |
def breaker(rands): | |
inv_c = [0, -55, 0, 0, 165, 0, 0, -330, 0, 0, 462, 0, 0, -462, 0, 0, 330, 0, 0, -165, 0, 0, 55, 1, 0, -11, -12, 0, 1, 11, 0] | |
for i in range(2**13): | |
m2s = Integer(i).digits(base=2, padto=13) | |
seed = R(0) | |
index2s = 0 | |
for i in range(31): | |
if inv_c[i] != 0: | |
seed += R((rands[i]*2 + m2s[index2s])*inv_c[i]) |
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
#include <stdio.h> | |
#include <gcrypt.h> | |
int main (int argc, const char **argv) { | |
printf("%s\n", gcry_check_version(NULL)); | |
return 0; | |
} |
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
#include <stdio.h> | |
#include <gcrypt.h> | |
int main () { | |
gcry_error_t gcryError; | |
gcry_cipher_hd_t gcryCipherHd; | |
size_t index; | |
char * salsaKey = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // 32 bytes | |
char * iniVector = "AAAAAAAA"; // 8 bytes |
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
from salsa20 import Salsa20_keystream | |
a_str = Salsa20_keystream(100, "A"*8, 'a'*32) | |
print a_str.encode('hex') |
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
#include <stdio.h> | |
#include <gcrypt.h> | |
int main () { | |
size_t index; | |
size_t txtLength = 4; | |
char * hashBuffer = malloc(33); | |
char * textBuffer = malloc(txtLength+1); | |
memset(hashBuffer, 0, 33); |
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
#include <stdio.h> | |
#include <sqlite3.h> | |
static int callback(void *NotUsed, int argc, char **argv, char **azColName){ | |
int i; | |
for(i=0; i<argc; i++){ | |
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); | |
} | |
printf("\n"); | |
return 0; |
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
#include <cstring> | |
#include <stdexcept> | |
void go(char *data) { | |
char name[64]; | |
strcpy(name, data); | |
} | |
int main(int argc, char **argv) { | |
go(argv[1]); |
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 hashlib, cProfile | |
f=file('dictionary.txt','r') | |
words = [word.strip() for word in f] | |
f.close() | |
secretHash=hashlib.sha512("banana").hexdigest() | |
def checkDictionary(secret): | |
return [word for word in words if hashlib.sha512(word).hexdigest() == secret] |
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
m="Hi there" | |
print m | |
hexstr = m.encode('hex') | |
print hexstr | |
integer_m = int(hexstr, 16) |
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
from Crypto.Util.number import * | |
p = getStrongPrime(512) | |
a = getRandomRange(2, p-2) | |
print GCD(a, p-1) | |
#loop until you get a GCD of 1 with p-1 | |
base = 2 | |
A = pow(base, a, p) | |
print p, base, A |