MTRX1702 - C Programming
Assignment 2
This assignment requires you to design and build a program that hides the contents of
a data le inside a bitmap le. The original data le may subsequently be recovered
from the modi ed bitmap le.
This assignment should take an average student 12 hours to complete.
Submission Deadline: 23:59 pm on the Sunday, 27th of October.
Late submissions will be penalised.
The proportion of the overall marks allocated to each component of the assignment
is indicated after the title enclosed in square brackets.
1 Background
Steganography (which means \concealed writing") is the art of writing hidden mes-
sages, disguised as a clearly visible but innocuous cover message.1 Historically, hidden
messages have taken many forms including the use of invisible ink, or marking selected
letters with pin-pricks, or using cut-out grilles to cover most of a message except the
relevant letters. In ancient times, Histiaeus shaved the head of a trusted slave, tattooed
a message on it, and hid it by waiting for the slave's hair to regrow. In the period fol-
lowing the rst World War, covert messages were photographically reduced to the size
of a full-stop and printed as microdots in ordinary letters and sent via regular post.
The purpose of steganography is to send a message without attracting the attention
of unwary third parties. This is di erent to encryption, where others may be aware
of and possibly intercept encoded messages, but are unable to interpret them. Even
with unbreakable encryption, an encoded message is likely to arouse suspicion, which
is problematic for a covert or under-cover operative. Steganography on the other hand
permits subterfuge in plain sight of the enemy, allowing the obscured message to pass
by unnoticed.
The current digital age facilitates a form of steganography wherein the low-order
bits of an image or audio le are replaced with the message bits. These bits typically
have insigni cant in
uence on the appearance or sound of the original le, and so they
can be modi ed without noticeable e ect. This assignment is concerned with image-
based steganography. You are to hide the contents of a data le in the low-order bits
of a bitmap image le, and later retrieve the original data from a modi ed image.
2 Windows Bitmap Files
Your program is to operate on uncompressed Windows Bitmap les with 24-bit colour
encoding. This is one of the simplest available le-formats and is composed of a \header
block" followed by colour data for each image pixel.
[header info] [pixel 1] ... [pixel N]
1For more information on Steganography, see http://en.wikipedia.org/wiki/Steganography.
1
The contents of the header is not relevant to this project. All you need to know is how
many bytes are in the header so as to skip over them to get to the pixel data. Each
pixel is represented by three bytes; one each for the red, green and blue components of
its colour. Thus, the intensity for a component (eg., red) of a single pixel is given by
an 8-bit value (ie., 0 to 255 unsigned char). It is therefore clear that the low-order
pixel information is simply the least-signi cant bits of each byte.2
Your program shall copy the header block of the bitmap to the output le directly
and without change. The hidden message is to be stored in the low order bits of the
pixel data. You will be provided with code that analyses the bitmap le and tells you
the number of bytes in the header and the number of bytes of pixel data, so that the
separate treatment of header and pixel data is trivial.
3 Basic Speci cation [60%]
Interface. The program is to have a command-line interface. This means using the
alternative form of main() that takes command-line arguments (see Section 13.4 of the
course text).
int main(int argc, char **argv)
The interface for encoding a data le inside a bitmap le takes three lenames as
arguments.3
steg <bmpfile> <datafile> <outputfile>
In this case, <bmpfile> is a Windows bitmap le, <datafile> is the data le, and
<outputfile> is the modi ed bitmap that contains the hidden message. The interface
for decoding a modi ed bitmap and recovering the data le takes only two arguments.
steg <bmpfile> <outputfile>
Here <bmpfile> is a modi ed bitmap and <outputfile> is the recovered data le.
Encoding algorithm. To store the data le inside the bitmap le, the following
steps are carried out.
The BitmapO set eld of the le header is read to identify the start of the pixel
data.
The header block is written to output verbatim.
The rst 32 bytes of pixel data are reserved to store the size of the input data
le. The size is to be stored in the least-signi cant bit of these 32 bytes.
2Compare this to the 8-bit Windows Bitmap le-format, where each pixel is represented by a single
byte, and colour is determined by a colour-map lookup table. In this case the low-order information is
not necessarily the least-signi cant bits of the byte.
3Here the executable is named steg. You may give your executable a di erent name, if you wish.
It does not matter since you will only submit your source code les.
2
Compute the amount of space required to store the input data. From this, com-
pute the number of bits in each pixel byte that will have to be modi ed so as
to store the data. For example, a small data le of N bytes might t into the
least-signi cant bit of the rst 8N pixel bytes. A larger le might need to modify
the two lowest bits of some bytes. In the worst case, the data le will modify all
8 bits of some or all of the pixel bytes, (in which case the data will not be well
hidden).
Store the bits of the data le in the low-order positions of the pixel bytes.
The last step requires the use of bitwise operations. You will read in a byte from the
data le and spread its bits across several pixel bytes.
Decoding algorithm. To extract the data le from the modi ed bitmap involves
the following steps.
Skip over the bitmap header block.
Get the number of bytes of the data le from the rst 32 bytes of the pixel data.
Compute the number of bits from each pixel that store the hidden data.
Extract the relevant bits and reconstruct the data le.
Messages. The program shall provide feedback to the user by printing messages to
the screen. There are three non-error messages.
Usage message. If the program is run with no additional arguments, or the wrong
number of arguments, it is to print the following message and terminate.
Usage: (encode or decode, respectively)
steg <bmpfile> <datafile> <outputfile>
steg <bmpfile> <outputfile>
Overwrite output le. If the output le already exists, query whether to overwrite,
terminating the program if the user doesn't type 'y'.
Output file <filename> already exists. Overwrite (y/n)?
Maximum number of bits modi ed. The ratio of the data le size to the number
of pixel bytes will determine the maximum number of low-order bits per byte that
are overwritten. The program shall print this number.
There was a maximum of <N> bits modified per byte.
3
Errors. If the program encounters an error, it is to print an error message to the
screen and terminate. In particular, the program shall include the following error
messages.
Unable to open a le.
Error: Could not open file <filename>.
Encoding error, where the bitmap is not big enough to store the entire data- le.
Error: Bitmap too small to store data file.
Decoding error, where the 32-bit value that denotes the size of the hidden data
is larger than the available space in the bitmap.
Error: Expected data size is larger than available space in bitmap.
3.1 Compiling
Your submission will be compiled using the following command in the Visual Studio
2010 Command Prompt:
cl *.c
If your program does not compile when this command is run, it cannot
be assessed for compliance with the speci cation and you will receive 0%
for this component of the assignment.
4 Extensions [20%]
If the basic speci cation as described above is implemented, the maximum possible
mark for the assignment shall be 80%. In order to gain a mark of greater than 80%,
one or more extensions must be implemented. These extensions should extend the
functionality of the above program in a useful and appropriate way, given the speci ed
goals of the program. Some suggested extensions are:
Include an interactive user interface in addition to the command-line interface.
Calculate a checksum and include that checksum within the hidden message to
validate the successful decoding of a message.
Calculate an indication of the overall level of le corruption caused by the stegano-
graphic process.
Implement compression by identifying whether the input le uses only ASCII
characters. (This would require additional 'header' information beyond the size
of the output le to be included in the hidden data.)
Parse the header to verify that the le is actually a supported bitmap.
4
Implement Doxygen-style commenting to enhance the quality of the project doc-
umentation.
Create a make le so that the program can be compiled by gcc using the single
command make.
Other possible extensions will also be considered. The suitability of any other
extensions should be discussed by e-mail with the Lecturer (j.ward@acfr.usyd.edu.au).
5 Documentation [20%]
The documentation for this assignment shall comprise two components. In-source doc-
umentation, and a separate short report.
Appropriate commenting and descriptive variable names should be used in all source
code to maximise readability. This will be marked based on the ability of the reader
to understand the operation of the code without reference to the accompanying re-
port. This in-code documentation should NOT discuss design decisions, but simply
the implementation of the program. Each function must have a comment header block
describing the inputs, outputs and a one-sentence description of the operation of the
function.
The short report shall contain a discussion of each module within the program, the
functionality of the module, and the data-
ows between each of the modules. Do not
discuss each individual function within the program. Simply discuss the functionality
of each module as a whole, their dependencies, and list the component functions. If a
multi- le approach to the project has been implemented, ensure the le boundaries are
indicated within the modular discussion. Use diagrams where appropriate. This report
is expected to ll 2-3 pages.
The report shall also include a \Statement of Compliance", which describes how
well the implemented programme complies with the speci cation in the assignment
sheet. It must identify all points of non-compliance, and may provide a justi cation
for this non-compliance. The Statement of Compliance must also clearly and brie
y
describe the additional functionality provided by any extensions.
5

C语言代写的更多相关文章

  1. 奥运会订票系统c语言代写源码下载

    制作能够实现2008北京奥运会网上订票的系统,能够实现购票人员注册.购票.管理人员可以设置各个比赛场地的赛事安排及票数. 程序要求实现的功能如下: 购票者信息注册:购票者可以用昵称和身份证进行注册,若 ...

  2. C++代做,C++编程代做,C++程序代做,留学生C++ Lab代写

    C++代做,C++编程代做,C++程序代做 我们主要面向留学生,广泛接美加澳国内港台等地编程作业代写,中英文均可. C语言代写 C++代写 Python代写 Golang代写 Java代写 一年半的时 ...

  3. 如何鉴别程序抄袭c语言程序代写

    如何鉴别程序抄袭:如何鉴别一份程序代码是抄袭另一份程序.输入:两个C语言源程序文件 输出:抄袭了多少?给出最相似的片段,判断是谁抄袭了谁? 提示:首先进行统一规范化排版,去掉无谓的空格.空行,然后比对 ...

  4. 实验教学管理系统 c语言程序代写源码下载

    问题描述:实验室基本业务活动包括:实验室.班级信息录入.查询与删除:实验室预定等.试设计一个实验教学管理系统,将上述业务活动借助计算机系统完成. 基本要求: 1.必须存储的信息 (1)实验室信息:编号 ...

  5. 基于JAVA WEB技术旅游服务网站系统设计与实现网上程序代写

    基于JAVA WEB技术旅游服务网站系统设计与实现网上程序代写 专业程序代写服务(QQ:928900200) 随着社会的进步.服务行业的服务水平不断发展与提高,宾馆.酒店.旅游等服务行业的信息量和工作 ...

  6. 代写编程的作业、笔试题、课程设计,包括但不限于C/C++/Python

    代写编程作业/笔试题/课程设计,包括但不限于C/C++/Python 先写代码再给钱,不要任何定金!价钱公道,具体见图,诚信第一! (截止2016-11-22已接12单,顺利完成!后文有成功交付的聊天 ...

  7. 代写assignment

    集英服务社,强于形,慧于心 集英服务社,是一家致力于优质学业设计的服务机构,为大家提供优质原创的学业解决方案.多年来,为海内外学子提供了多份原创优质的学业设计解决方案. 集英服务社,代写essay/a ...

  8. c编写程序完成m名旅客和n辆汽车的同步程序代写

    jurassic公园有一个恐龙博物馆和一个公园,有m名旅客和n辆汽车,每辆汽车仅能允许承载一名旅客.旅客在博物馆参观一阵,然后排队乘坐旅行车.当一辆车可用时,他载入一名旅客,再绕花园行驶任意长的时间. ...

  9. 模拟游客一天的生活与旅游java程序代写源码

    在某个城市的商业区里,有一家首饰店,一家饭店,一家面馆,一家火锅店,一家银行,一家当铺 现在有一群来自四川的游客,一群陕西的游客,一群上海的游客,和以上各店家的工作人员在此区域里,请模拟他们一天的生活 ...

随机推荐

  1. 5.11-5.15javascript制作动态表格

    制作动态表格的主要是运用js中表格类的insertRow.insertCell简易添加行和列的代码,不过要注意每行添加的表格是有位置行编号的,每行的编号为rows.length-1,增加的表格内的标签 ...

  2. css三角形

    <html><head> <meta charset="UTF-8"></head><style> div{float: ...

  3. 一些常用的Bootstrap模板资源站

    2013-11-13 23:28:09   超级Bootstrap模板库:http://www.wrapbootstrap.com/ 免费的HTML5 响应式网页模板:http://html5up.n ...

  4. Hexo搭建Github静态博客

    1. 环境环境 1.1 安装Git 请参考[1] 1.2 安装node.js 下载:http://nodejs.org/download/ 可以下载 node-v0.10.33-x64.msi 安装时 ...

  5. Cocos2d-x3.6 Android编译问题

    在Cocod2d-x论坛上看到越来越多人吐槽新版本更新太快,改动太大,而且经常有BUG导致升级要折腾很久很久..但我就是喜欢折腾,喜欢升级到最新版本,看看有了哪些新功能,哪些改进.为此也折腾了不少,遇 ...

  6. Atitit.提升稳定性-----分析内存泄漏PermGen OOM跟解决之道...java

    Atitit.提升稳定性-----分析内存泄漏PermGen OOM跟解决之道...java 1. 内存区域的划分 1 2. PermGen内存溢出深入分析 1 3. PermGen OOM原因总结 ...

  7. bzoj 3399: [Usaco2009 Mar]Sand Castle城堡

    3399: [Usaco2009 Mar]Sand Castle城堡 Time Limit: 3 Sec  Memory Limit: 128 MB Description 约翰用沙子建了一座城堡.正 ...

  8. Atom插件安装及常用插件推荐

    Atom是个不错的文本编辑工具,也该可以改造成IDE用,主要靠插件实现各种扩展功能. 因为网络环境的原因,在线安装不容易成功,一般选择手动安装. 以下是我搜索网络资源后总结的手动安装方法. Atom插 ...

  9. Android中的IOC框架,完全注解方式就可以进行UI绑定和事件绑定

    转载请注明出处:http://blog.csdn.net/blog_wang/article/details/38468547 相信很多使用过Afinal和Xutils的朋友会发现框架中自带View控 ...

  10. Android中的内部类引起的内存泄露

    引子 什么是内部类?什么是内存泄露?为什么Android的内部类容易引起内存泄露?如何解决? 什么是内部类? 什么是内部类?什么又是外部类.匿名类.局部类.顶层类.嵌套类?大家可以参考我这篇文章 ,再 ...