.4 Kết quả nhúng thủy vẫn hữu hình

Một phần của tài liệu (LUẬN VĂN THẠC SĨ) Nghiên cứu phương pháp bảo vệ bản quyền tài liệu số hóa (Trang 80 - 87)

4.3 MỘT SỐ ĐOẠN MÃ NGUỒN QUAN TRỌNG.

Mã nhúng thủy vân bằng LSB:

private Bitmap LSB_embedding(Bitmap bmp_file)

{

Bitmap bmp_embedding; Color color;

bool[,] usedpos;

char[] w = new char[textdata.Length]; char w_item;

int i = 0, j = 0, index = 0; ushort c_mask1, c_mask2, c_mask3; w = textdata.ToCharArray();

bmp_embedding = bmp_file;

if (bmp_embedding.PixelFormat == PixelFormat.Format24bppRgb) {

usedpos = new bool[bmp_embedding.Width, bmp_embedding.Height];

bmp_embedding.SetPixel(0, 0, Color.FromArgb(0,

textdata.Length>>8, textdata.Length & 0x00ff)); usedpos[0, 0] = true;

Random rndobj;

if (key1.Text.Length == 0) {

rndobj = new Random(10); }

else

{

rndobj = new Random(Convert.ToInt16(key1.Text)); }

for (index = 0; index < textdata.Length; index++) { ushort bytemask = 0x0001; w_item = w[index]; progressBar1.Value = index; id1: if (usedpos[i, j] == true) { i = rndobj.Next(bmp_embedding.Width); j = rndobj.Next(bmp_embedding.Height); goto id1; } for (int z = 0; z < 4; z++) { if (i + 1 >= bmp_embedding.Width) {

i = 0; if (j + 1 >= bmp_embedding.Height) j = 0; else j = j + 1; } id2: if (usedpos[i, j] == true) { i = rndobj.Next(bmp_embedding.Width); j = rndobj.Next(bmp_embedding.Height); goto id2; }

c_mask1 = ((w_item & bytemask) != 0) ?

(ushort)1 : (ushort)0; bytemask *= 2;

c_mask2 = ((w_item & bytemask) != 0) ?

(ushort)1 : (ushort)0; bytemask *= 2;

c_mask3 = ((w_item & bytemask) != 0) ?

(ushort)1 : (ushort)0; bytemask *= 2;

color = bmp_embedding.GetPixel(i, j); bmp_embedding.SetPixel(i, j,

Color.FromArgb((color.R & 0xFFFE) | c_mask1, (color.G & 0xFFFE) | c_mask2, (color.B & 0xFFFE) | c_mask3));

usedpos[i, j] = true; } if (i + 1 >= bmp_embedding.Width) { i = 0; if (j + 1 >= bmp_embedding.Height) j = 0; else j = j + 1; } id3: if (usedpos[i, j] == true) { i = rndobj.Next(bmp_embedding.Width); j = rndobj.Next(bmp_embedding.Height); goto id3; }

c_mask1 = ((w_item & bytemask) != 0) ? (ushort)1 :

(ushort)0; bytemask *= 2;

c_mask2 = ((w_item & bytemask) != 0) ? (ushort)1 :

(ushort)0; bytemask *= 2;

color = bmp_embedding.GetPixel(i, j); bmp_embedding.SetPixel(i, j,

Color.FromArgb((color.R & 0xFFFE) | c_mask1, (color.G & 0xFFFE) | c_mask2, (color.B & 0xFFFC) | (w_item >> 14)));

usedpos[i, j] = true; } progressBar1.Visible = false; } return bmp_embedding; }

Mã rút trích thủy vân bằng kỹ thuật LSB:

public String LSB_extraction(Bitmap bmp_file)

{

Bitmap bmp_extraction; String kq;

Color color;

int length, index, i=0, j=0; char[] w;

char w_item; bool[,] usedpos;

ushort c_mask1 = 0, c_mask2 = 0, c_mask3 = 0;

bmp_extraction = bmp_file;

length = bmp_extraction.GetPixel(0, 0).B | (bmp_extraction.GetPixel(0,0).G << 8); w = new char[length];

progressBar2.Visible = true; progressBar2.Minimum = 0;

progressBar2.Maximum = length;

if (bmp_extraction.PixelFormat == PixelFormat.Format24bppRgb) {

usedpos = new bool[bmp_extraction.Width, bmp_extraction.Height];

usedpos[0, 0] = true; // Because be got pixel at 0, 0

Random rndobj;

if (key2.Text.Length == 0) {

rndobj = new Random(10); }

else

{

rndobj = new Random(Convert.ToInt16(key2.Text)); }

for (index = 0; index < length; index++) {

w_item = (char)(w_item & 0); progressBar2.Value = index; id4: if (usedpos[i, j] == true) { i = rndobj.Next(bmp_extraction.Width); j = rndobj.Next(bmp_extraction.Height); goto id4; } for (int z = 0; z < 4; z++) { if (i + 1 >= bmp_extraction.Width) {

i = 0; if (j + 1 >= bmp_extraction.Height) j = 0; else j = j + 1; } id5: if (usedpos[i, j] == true) { i = rndobj.Next(bmp_extraction.Width); j = rndobj.Next(bmp_extraction.Height); goto id5; } color = bmp_extraction.GetPixel(i, j);

c_mask1 = (ushort)((color.R & 0x0001) << (0 + 3 * z)); c_mask2 = (ushort)((color.G & 0x0001) << (1 + 3 * z)); c_mask3 = (ushort)((color.B & 0x0001) << (2 + 3 * z)); w_item = (char)(w_item | c_mask1 | c_mask2 | c_mask3); usedpos[i, j] = true; } if (i + 1 >= bmp_extraction.Width) { i = 0; if (j + 1 >= bmp_extraction.Height) j = 0; else j = j + 1; } id6: if (usedpos[i, j] == true) { i = rndobj.Next(bmp_extraction.Width); j = rndobj.Next(bmp_extraction.Height); goto id6; } color = bmp_extraction.GetPixel(i, j);

c_mask1 = (ushort)((color.R & 0x0001) << 12); c_mask2 = (ushort)((color.G & 0x0001) << 13); c_mask3 = (ushort)((color.B & 0x0003) << 14);

w_item = (char)(w_item | (c_mask1 | c_mask2 | c_mask3)); usedpos[i, j] = true; w[index] = w_item; } progressBar2.Visible = false; } kq = new String(w); return kq; }

KẾT LUẬN

Trên đây là những nghiên cứu tìm hiểu về bảo vệ bản quyền tài liệu số hóa. Những vấn kề liên quan đến bảo vệ bản quyền số hóa đã đƣợc nghiên cứu và hệ thống một cách khoa học nhằm đem lại cái nhìn khái quát nhất về bảo vệ bản quyền tài tài nguyên số.

Luận văn đã tìm hiểu, nghiên cứu hình thức “bảo vệ bản quyền” các tài nguyên số thƣờng đƣợc trao đổi trên Internet.

Luận văn đã đạt đƣợc những kết quả chính sau:

1. Nghiên cứu tìm hiểu tài liệu, hệ thống lại các vấn đề về an toàn thông tin: - Kiến thức về mã hóa ký số.

- Kiến thức về Giấu tin và Thủy vân số.

- Kiến thức về xác thực và chống chối cãi trong giao dịch điện tử.

2. Nghiên cứu các dạng dữ liệu đƣợc số hóa và lƣu trữ trong máy tính, nhƣ văn bản, âm thanh, hình ảnh. Từ đó tìm hiểu cách thức lƣu trữ của từng cấu trúc tệp tin đƣợc dùng phổ biến trên Internet. Nhằm nắm bắt đƣợc cách thức lƣu trữ từ đó xác định phƣơng pháp giấu tin (thủy vân) tƣơng ứng với từng loại tệp khác nhau.

3. Nghiên cứu các cách thức bảo vệ bản quyền tài nguyên số. Luận văn đã tìm hiểu và đề xuất một số thuật toán nhằm bảo vệ bản quyền tài nguyên số theo một số cách thức nhƣ: bảo mật tài nguyên số, Thủy vân chống xuyên tạc ảnh nhăm bảo vệ nội dung ảnh, Thủy vân bền vững để nhúng thông tin về quyền tác giả đối với tài nguyên số.

BẢNG CHỮ VIẾT TẮT DSS -Digital Signature Standard

HVS- Human Visuality System

HVS - Human Visuality System

P2P -Per-to-Per

CRC - Cyclic Redundancy Check

TA - Trusted Authority

CA -Certificate Authority

RA - Registration Authority

PKI - Public Key Infrastructure

PCM - Pulse Code Modulation

IFF - Interchange File Format

RIFF - Resource Interchange File Format

LSB - LeastSignificationBits.

TÀI LIỆU THAM KHẢO

Tiếng Việt.

[1]. GS.TS Phan Đình Diệu, “Giáo trình Lý thuyết mật mã và an toàn thông tin”.

[2]. Phạm Huy Điển, Hà Huy Khoái, “Mã hóa thông tin – Cơ sở toán học và ứng dụng”, nhà xuất bản Đại học Quốc gia Hà Nội, (2004).

[3]. Lƣơng Chi Mai, Huỳnh Thị Thanh Bình, "Nhập Môn Đồ Hoạ Máy Tính", nhà xuất bản Khoa học và Kỹ thuật, tr 65-75, (2000).

[4]. Nguyễn Gia Bình, Võ Nguyễn Quốc Bảo, “Xử lý âm thanh, Hình ảnh”, Viện công nghệ Bƣu chính viễn thông, (2007).

[5]. Thái Hồng Nhị, Phạm Minh Việt, “An toàn thông tin”, nhà xuất bản khoa học kỹ thuật, (2004).

Tiếng Anh

[6]. A. Menezes, P.van Oorshot, and S. Vanston, “Handbook of Applied Cryptgraphy,

CRC Press, (1996).

[7]. Orea Flores, M.A.Acevedo, J.López-Bonilla, “Wavelet and Discrete cosine transforms for inserting information into BMP images”, Australia Mathematical Society, (2006). [8]. Syed Ali Khayam, “DCT: Theory and Application”, Michigan State University, (2003). [9]. Matteo Fortini, "Steganography and Digital Watermarking: a global view" pp 1, (2000). [10]. Ingemar J. Cox, Matthew L. Miller, and Jeffrey A. Bloom, “Digital Watermarking”,

Một phần của tài liệu (LUẬN VĂN THẠC SĨ) Nghiên cứu phương pháp bảo vệ bản quyền tài liệu số hóa (Trang 80 - 87)

Tải bản đầy đủ (PDF)

(87 trang)