C语言代写
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语言代写的更多相关文章
- 奥运会订票系统c语言代写源码下载
制作能够实现2008北京奥运会网上订票的系统,能够实现购票人员注册.购票.管理人员可以设置各个比赛场地的赛事安排及票数. 程序要求实现的功能如下: 购票者信息注册:购票者可以用昵称和身份证进行注册,若 ...
- C++代做,C++编程代做,C++程序代做,留学生C++ Lab代写
C++代做,C++编程代做,C++程序代做 我们主要面向留学生,广泛接美加澳国内港台等地编程作业代写,中英文均可. C语言代写 C++代写 Python代写 Golang代写 Java代写 一年半的时 ...
- 如何鉴别程序抄袭c语言程序代写
如何鉴别程序抄袭:如何鉴别一份程序代码是抄袭另一份程序.输入:两个C语言源程序文件 输出:抄袭了多少?给出最相似的片段,判断是谁抄袭了谁? 提示:首先进行统一规范化排版,去掉无谓的空格.空行,然后比对 ...
- 实验教学管理系统 c语言程序代写源码下载
问题描述:实验室基本业务活动包括:实验室.班级信息录入.查询与删除:实验室预定等.试设计一个实验教学管理系统,将上述业务活动借助计算机系统完成. 基本要求: 1.必须存储的信息 (1)实验室信息:编号 ...
- 基于JAVA WEB技术旅游服务网站系统设计与实现网上程序代写
基于JAVA WEB技术旅游服务网站系统设计与实现网上程序代写 专业程序代写服务(QQ:928900200) 随着社会的进步.服务行业的服务水平不断发展与提高,宾馆.酒店.旅游等服务行业的信息量和工作 ...
- 代写编程的作业、笔试题、课程设计,包括但不限于C/C++/Python
代写编程作业/笔试题/课程设计,包括但不限于C/C++/Python 先写代码再给钱,不要任何定金!价钱公道,具体见图,诚信第一! (截止2016-11-22已接12单,顺利完成!后文有成功交付的聊天 ...
- 代写assignment
集英服务社,强于形,慧于心 集英服务社,是一家致力于优质学业设计的服务机构,为大家提供优质原创的学业解决方案.多年来,为海内外学子提供了多份原创优质的学业设计解决方案. 集英服务社,代写essay/a ...
- c编写程序完成m名旅客和n辆汽车的同步程序代写
jurassic公园有一个恐龙博物馆和一个公园,有m名旅客和n辆汽车,每辆汽车仅能允许承载一名旅客.旅客在博物馆参观一阵,然后排队乘坐旅行车.当一辆车可用时,他载入一名旅客,再绕花园行驶任意长的时间. ...
- 模拟游客一天的生活与旅游java程序代写源码
在某个城市的商业区里,有一家首饰店,一家饭店,一家面馆,一家火锅店,一家银行,一家当铺 现在有一群来自四川的游客,一群陕西的游客,一群上海的游客,和以上各店家的工作人员在此区域里,请模拟他们一天的生活 ...
随机推荐
- I535卡刷土豆修改4.1.2版本ROMV4過程
I535卡刷土豆修改版本ROMV4過程 一.首先在电脑上安装I535的电脑驱动程序 二.備份EFS,備份舊ROM(网上有教程) 三.解锁:下载EZ-Unlock解锁. 四.檢查Recovery是否為最 ...
- 【leetcode】Linked List Cycle
这个题真是坑死了,只怪自己不好吧.一开始审题,以为是给定一个首尾相连的链表,查看其中是否有循环(原谅我的无知吧!!).然后在那写啊写啊写,还在纠结是局部循环还是前一半和后一半一样这样的循环,blah ...
- java编程规范
一.规范存在的意义 应用编码规范对于软件本身和软件开发人员而言尤为重要,有以下几个原因: 1.好的编码规范可以尽可能的减少一个软件的维护成本 , 并且几乎没有任何一个软件,在其整个生命周期中,均由最初 ...
- WP8:Unity3D之间的值传递
在前面的讨论中,我们介绍了如何在Unity3D for WP8中使用高于.Net 3.5的第三方库,传送门:http://www.cnblogs.com/zhxilin/p/3311240.html ...
- C语言 线性表 链式表结构 实现
一个单链式实现的线性表 mList (GCC编译). /** * @brief 线性表的链式实现 (单链表) * @author wid * @date 2013-10-21 * * @note 若代 ...
- 小觑数据库(SqlServer)查询语句执行过程
近年来,越来越多的NoSql产品不断的以技术革命的者的身份跳出来:“你看哥是多么的快,你们关型型数据库真是战五渣阿”.是的,高性能的场景下NoSql真的很出彩.而我们关系型数据库只能在墙角哭泣&quo ...
- 收缩SQL Server日志不是那么简单的(翻译)
原文地址:http://rusanu.com/2012/07/27/how-to-shrink-the-sql-server-log/ 说明:本文为了更好的说明收缩的过程,在原文翻译的基础上增加了一些 ...
- JSLint JavaScript代码质量审查工具汉化中文版隆重发布
JSLint是一款JavaScript代码质量审查工具,它可以指出代码中错误.不规范的地方,非常之严格,甚至多写一个空格都会发出警告. JSLint的审查规则,根据众多前辈多年编程经验而写,字字珠玑, ...
- html5之touch事件
前言 一个触屏网站到底和传统的pc端网站有什么区别呢,交互方式的改变首当其冲.例如我们常用的click事件,在触屏设备下是如此无力. 手机上的大部分交互都是通过touch来实现的,于是,对于触屏的交互 ...
- 解决Eclipse Debug source not found问题
解决方法如下:Debug 视图下-->在调试的线程上 右键单击-->选择Edit Source Lookup Path-->选择Add-->选择Java Project选择相应 ...