File: gifshuffle.1

package info (click to toggle)
gifshuffle 2.0-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 180 kB
  • ctags: 173
  • sloc: ansic: 2,113; makefile: 17
file content (159 lines) | stat: -rw-r--r-- 6,174 bytes parent folder | download | duplicates (2)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
.TH gifshuffle 1 "5 Jan 2003" "Version 2.0"
.SH NAME
gifshuffle \- GIF colourmap steganography program
.SH SYNOPSIS
.B gifshuffle
[
.B -CQS1
] [
.B -p
.I passwd
] [
.B -f
.I file
|
.B -m
.I message
] [
.I infile.gif
[
.I outfile.gif
]]
.SH DESCRIPTION
\fBgifshuffle\fP is a program for concealing messages in GIF images
by shuffling the colourmap. A shuffled image is visibly indistinguishable
from the original. \fBgifshuffle\fP works with all GIF images, including
those with transparency and animation.
.PP
Consider a pack of 52 cards. There are 52 factorial ways to sort the pack,
which means that any particular ordering of the cards can represent a
number in the range [0, 52!-1]. In other words, given \fIn\fP cards,
you can store approximately log2(n!) bits of information based on their
ordering.
.PP
GIF images contain a colourmap with up to 256 entries, resulting in a
maximum storage capacity of 1675 bits. The image itself consists of a
compressed array of indices into this colourmap. To conceal a message
within a GIF image the following steps take place.
.IP 1.
Start with the message you want to conceal, specified on the command line
or in a file. Optionally compress and/or encrypt this message. You are
then left with a sequence of \fI1\fP's and \fI0\fP's.
.IP 2.
Prepend a \fI1\fP to this sequence, giving you a binary number \fIm\fP
(probably quite large).
.IP 3.
Next take a look at the GIF image that you want to conceal the message in.
Count the number of unique colours in the image, and call the value \fIn\fP.
If \fIm\fP > \fIn\fP!-1 then the message is too large, and the procedure
will be aborted.
.IP 4.
The colours in the colourmap are first sorted into their "natural" order
(except when encryption is being used - see details below).
Each RGB colour is assigned the value (red * 65536 + green * 256 + blue),
and the colours are sorted according to these values. Any duplicate
colours are removed.
.IP 5.
Iterate \fIi\fP through the values 1 .. \fIn\fP. Each colour \fIi\fP-1
is allocated a target position (\fIm\fP mod \fIi\fP), then \fIm\fP
is divided by \fIi\fP.
.IP 6.
Each colour is then in turn inserted into a new colourmap at its
target position. Colours previously occupying the target position and
above are moved up one place.
.IP 7.
If the size of the colourmap is greater than the number of unique
colours, then the colourmap will be padded with the last colour from
the original colourmap.
.IP 8.
The image component of the GIF is then uncompressed, the colour indices
are re-mapped to the new colourmap, and the image is re-compressed. For
animated GIFs this is repeated for each image.
.PP
Extracting a hidden message follows a similar procedure, but in reverse.
The ordering of the colourmap is used to construct a binary number,
which is then optionally decrypted and uncompressed before being output.
.PP
\fBgifshuffle\fP provides rudimentary compression, using Huffman tables
optimised for English text. However, if the data is not text, or if
there is a lot of data, the use of the built-in compression is not
recommended, since an external compression program such as
\fBcompress\fP or \fBgzip\fP will do a much better job.
.PP
Encryption is also provided, using the ICE encryption algorithm in 1-bit
cipher-feedback (CFB) mode to encrypt the data (after compression).
Because of ICE's arbitrary key size, passwords of any length up to 1170
characters are supported (since only 7 bits of each character are used,
this means keys up to 1024-bytes are supported).
.PP
As of \fBgifshuffle 2.0\fP encryption is also applied to the ordering
of the colours in the colourmap. Instead of using their "natural"
ordering, the ordering of their encrypted hash is used. This has the
benefit of making colourmaps look random even when there is only a
small message concealed. To disable this feature (which is incompatible
with version 1 of \fBgifshuffle\fP) use the \fB-1\fP option.
.PP
If a message string or message file are specified on the command-line,
\fBgifshuffle\fP will attempt to conceal the message in the file
\fIinfile.gif\fP if specified, or standard input otherwise.
The resulting file will be written to \fIoutfile.gif\fP if specified,
or standard output if not.
.PP
If no message string is provided, \fBgifshuffle\fP attempts to extract a
message from the input file. The result is written to the output file
or standard output.
.SH OPTIONS
.TP
.B -C
Compress the data if concealing, or uncompress it if extracting.
.TP
.B -Q
Quiet mode. If not set, the program reports statistics such as
compression percentages and amount of available storage space used.
.TP
.B -S
Report on the amount of space available for hidden message in the
GIF colourmap. This is calculated from the number of unique colours
in the image.
.TP
.B -1
Retain compatibility with version 1 of \fBgifshuffle\fP by ordering
colours using their "natural" ordering, rather than their encrypted
ordering. This is only relevant if a password is specified.
.TP
\fB-p\fP \fIpassword\fP
If this is set, the data will be encrypted with this password during
concealment, or decrypted during extraction.
.TP
\fB-f\fP \fImessage-file\fP
The contents of this file will be concealed in the input GIF image.
.TP
\fB-m\fP \fImessage-string\fP
The contents of this string will be concealed in the input GIF image.
Note that, unless a newline is somehow included in the string, a newline
will not be printed when the message is extracted.
.SH EXAMPLES
The following command will conceal the message "Meet me at 6" in the
file \fIinfile.gif\fP, with compression, and encrypted with the password
"hello world". The resulting text will be stored in \fIoutfile.gif\fP.
.PP
.RS
\fBgifshuffle -C -m "Meet me at 6" -p "hello world" infile.gif outfile.gif\fP
.RE
.PP
To extract the message, the command would be
.PP
.RS
\fBgifshuffle -C -p "hello world" outfile.gif\fP
.RE
.PP
Note that the resulting message will not be terminated by a newline.
.PP
The storage capacity of a file can be determined with the \fB-S\fP option.
.PP
.RS
\fBgifshuffle -S infile.gif\fP
.RE
.SH AUTHOR
This application was written by Matthew Kwan, who can be reached at
mkwan@darkside.com.au