-
Notifications
You must be signed in to change notification settings - Fork 0
/
encode.h
92 lines (66 loc) · 2.48 KB
/
encode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef ENCODE_H
#define ENCODE_H
#include "types.h" // Contains user defined types
/*
* Structure to store information required for
* encoding secret file to source Image
* Info about output and intermediate data is
* also stored
*/
#define MAX_SECRET_BUF_SIZE 1
#define MAX_IMAGE_BUF_SIZE (MAX_SECRET_BUF_SIZE * 8)
#define MAX_FILE_SUFFIX 4
typedef struct _EncodeInfo
{
/* Source Image info */
char *src_image_fname;
FILE *fptr_src_image;
uint image_capacity;
uint bits_per_pixel;
char image_data[MAX_IMAGE_BUF_SIZE];
/* Secret File Info */
char *secret_fname;
FILE *fptr_secret;
char extn_secret_file[MAX_FILE_SUFFIX];
char secret_data[MAX_SECRET_BUF_SIZE];
long size_secret_file;
/* Stego Image Info */
char *stego_image_fname;
FILE *fptr_stego_image;
} EncodeInfo;
/* Encoding function prototype */
/* Check operation type */
OperationType check_operation_type(char *argv[]);
/* Read and validate Encode args from argv */
Status read_and_validate_encode_args(char *argv[], EncodeInfo *encInfo);
/* Perform the encoding */
Status do_encoding(EncodeInfo *encInfo);
/* Get File pointers for i/p and o/p files */
Status open_files(EncodeInfo *encInfo);
/* check capacity */
Status check_capacity(EncodeInfo *encInfo);
/* Get image size */
uint get_image_size_for_bmp(FILE *fptr_image);
/* Get file size */
long get_file_size(FILE *fptr);
/* Copy bmp image header */
Status copy_bmp_header(FILE *fptr_src_image, FILE *fptr_dest_image);
/* Store Magic String */
Status encode_magic_string(char *magic_string, EncodeInfo *encInfo);
/* Encode Secret file extn size */
Status encode_secret_file_extn_size(int size, FILE *fptr_src_image, FILE *fptr_stego_image);
/* Encode secret file extenstion */
Status encode_secret_file_extn(char *file_extn, EncodeInfo *encInfo);
/* Encode secret file size */
Status encode_secret_file_size(int file_size, EncodeInfo *encInfo);
/* Encode secret file data*/
Status encode_secret_file_data(EncodeInfo *encInfo);
/* Encode function, which does the real encoding */
Status encode_data_to_image(char *data, int size, FILE *fptr_src_image, FILE *fptr_stego_image, EncodeInfo *encInfo);
/* Encode a byte into LSB of image data array */
Status encode_byte_to_lsb(char data, char *image_buffer);
/* Encode size to lsb */
Status encode_size_to_lsb(int size, char *image_buffer);
/* Copy remaining image bytes from src to stego image after encoding */
Status copy_remaining_img_data(FILE *fptr_src, FILE *fptr_dest);
#endif