Skip to content

Instantly share code, notes, and snippets.

View luafran's full-sized avatar

Luciano Afranllie luafran

View GitHub Profile
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
#from Crypto.Cipher import PKCS1_v1_5
from Crypto.Cipher import AES
from Crypto import Random
# Encrypting Side
plaintext1 = 'd683a86a-69c8-4c1f-8442-8a88208f4009.226287546443-fs1vpkb275ud6i4rcsk6vjajcaua1kb5'
print 'plaintext1:',plaintext1
key1 = Random.new().read(16)
@luafran
luafran / strings.c
Created October 1, 2013 20:28
Functions to calculate length, copy and compare strings. Taken from K&R book.
#include <stdio.h>
#include <string.h>
size_t slen(char *s);
void scpy(char *s, char *t);
int scmp(char *s, char *t);
const int STR_MAX_SIZE = 10;
int main()
@luafran
luafran / readlines.c
Created October 1, 2013 20:25
Read a file line by line using own mygetline function (taken from K&R book) and fgets.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLINE 1024
int mygetline(char *s, int lim);
int main()
{
@luafran
luafran / chars_in_both_strings.c
Created October 1, 2013 20:21
Print character present in two strings
#include <stdio.h>
#include <string.h>
int main()
{
char *s1 = "cdefghijklmnopqrstuvwxy";
char *s2 = "abxyz";
char array[256];
@luafran
luafran / bitcount.py
Created October 1, 2013 20:06
Print given number in binary format and count number of bit on and off
import sys
def bitsoncount(i):
assert 0 <= i < 0x100000000
i = i - ((i >> 1) & 0x55555555)
i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24
if len(sys.argv) < 2: