You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

61 lines
1.6 KiB

#include <string.h>
#include <time.h>
#include "hide.h"
#include "extract.h"
/*
*
* header :
* pixel 1 : taille du lsb dans les 3 derniers bits de R
* puis 32 bits de taille de la donnée suivant le lsb
* puis 8 bits bonus
*
*/
int main(int argc, char *argv[]) {
srand((unsigned int) time(NULL));
if (argc > 1) {
if (!strncmp(argv[1], "-h", 2) && argc >= 5) {
hide_lsb(argv[2], argv[3], argv[4], (byte) ((argc == 6) ? ((byte) argv[5][0] - 48) & 7u : 0));
return OK;
}
if (!strncmp(argv[1], "-e", 2) && argc >= 4) {
extract(argv[2], argv[3]);
return OK;
}
if (!strncmp(argv[1], "-c", 2) && argc >= 4) {
clean(argv[2], argv[3]);
return OK;
}
if (!strncmp(argv[1], "-i", 2) && argc >= 3) {
byte lsb = 0;
u32 length = 0;
string ext = "BKMG";
get_info(&lsb, &length, argv[2]);
u32 human = length;
while (human > 1000) {
human /= 1000;
ext++;
}
printf("%d bytes (%d%c) hidden in %d bit%s/channel (%d bits/px)\n", length, human, *ext, lsb,
(lsb > 1) ? "s" : "", lsb * 3);
return OK;
}
}
printf("DIP - a tool to hide things in PNG pictures\nwritten by astequ\n\nUsage :\n\t- hiding :"
" %s -h <picture.png> <data> <output.png>\n\t- extracting : %s -e <picture.png> <output.data>\n\t- cleaning"
" : %s -c <picture.png> <output.png>\n", argv[0], argv[0], argv[0]);
return COMMON_ERROR;
}