Skip to content

Instantly share code, notes, and snippets.

View AndyNovo's full-sized avatar

Andy Novocin AndyNovo

View GitHub Profile
@AndyNovo
AndyNovo / cstring.c
Created March 20, 2017 16:18
Character Array basic
#include "stdio.h"
int main(void) {
char text[128] = "Andy is the greatest";
//Old fashioned C strings
//char is a one byte integer type used to store an ASCII character
// char text[128] declares an array of 'char's and = "..." initializes the values stored in that array
// after the "t" in greatest there will be stored a null byte (00000000) to indicate the end of the character array
printf("%s\n", text);
//The format flag %s will print out the entire character array as text
@AndyNovo
AndyNovo / helloworld.c
Created March 20, 2017 15:41
Super commented hello world
#include "stdio.h"
//This #include line allows input/output (printf)
//Lines that start with # are handled by the preprocessor
//Lines that start with '//' are comments
/* You can
also have multi-line
comments using '/*' and it's partner */
//There is always a "main" function which is what gets executed
base, p, A, b, B, K = (2, 10687697916839423481635652118834007146946191294923255999661800948347650137507026580619063362540990142707750877588667878612127060085500161314697355403684817, 2928243870826960095527291341465041733378889438215298802243486942058641990714876730583731143393190263600568508345339395159154963799337791343494391943691343, 3145210314820064242923507206669481373441142139974754058098783378176549671945497998282927729775598688573873767902141750162553709308511659052840059727418475, 243091867572058234977747830694512875533111671243488638254559652058902886471446388452939490802580633118475567282374030327794613305260510150217941576250986, 10641194206677418802665706883329799029279202711791423315137652972422041285490884720641376996879901644227818499713135456300204394885953287489010786875194858)
<?php
$pwd = "pass123";
$salt = "salt";
$r = 2;
function superhash($pss, $slt, $r){
$temp = "0";
for($i = 0; $i < $r; $i++){
$temp = hash("sha256", $temp.$pss.$slt, $raw_output=true);
}
import binascii, hashlib
k = "secretkey"
msg = "forge this punks"
kplus = k + "\x00"*(64-len(k))
ipad = "\x36"*64
opad = "\x5C"*64
def XOR(raw1, raw2):
import hmac, hashlib
print hmac.new("secretkey", "forge this punks", hashlib.sha256).hexdigest()
@AndyNovo
AndyNovo / crand.c
Last active January 17, 2017 02:46
#include "stdio.h"
#include "stdlib.h"
int main(void) {
unsigned int seed = 123;
srand(seed);
int i=0;
for(; i < 5; i++){
def crand(seed):
r=[]
r.append(seed)
for i in range(30):
r.append((16807*r[-1]) % 2147483647)
if r[-1] < 0:
r[-1] += 2147483647
for i in range(31, 34):
r.append(r[len(r)-31])
for i in range(34, 344):
sprintf(buffer, "/bin/mail %s < /tmp/email", addr);
system(buffer);
void * data;
data = NULL;
if(1)
{
{
char charBuffer = 'a';
data = &charBuffer;
}
}
printIntLine(*((int*)data));