资源简介
网络安全LSB算法 采用C# 实现文字的隐藏和读取
直接用visual studio 打开 .sln 文件即可

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace LSB算法CS实现
{
class DES
{
///
/// DES加密
///
///8-15bytes明文
///8bytes密鈅
///32bytes密文
public static string DESEncrypt(string content string key)
{
byte[] data = Encoding.UTF8.GetBytes(content);
DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
DES.Key = UTF8Encoding.UTF8.GetBytes(key);
DES.IV = UTF8Encoding.UTF8.GetBytes(key);
MemoryStream ms = new MemoryStream(); //內存流。
CryptoStream cs = new CryptoStream(ms DES.CreateEncryptor() CryptoStreamMode.Write);//內存流創建為加密轉換流
cs.Write(data 0 data.Length);
cs.FlushFinalBlock(); //用缓冲区的当前状态更新基础数据源或储存库,随后清除缓
StringBuilder ret = new StringBuilder();
foreach (byte b in ms.ToArray())
{
ret.AppendFormat(“{0:X2}“ b);
}
return ret.ToString();
}
///
/// DES解密
///
///32bytes密文
///8bytes密鈅
///8-15bytes明文
public static string DESDecrypt(string content string key)
{
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
//Put the input string into the byte array
byte[] inputByteArray = new byte[content.Length / 2];
for (int x = 0; x < content.Length; x += 2)
{
int i = Convert.ToInt32(content.Substring(x 2) 16);
inputByteArray[x / 2] = (byte)i;
}
des.Key = UTF8Encoding.UTF8.GetBytes(key);
des.IV = UTF8Encoding.UTF8.GetBytes(key);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms des.CreateDecryptor() CryptoStreamMode.Write);
//Flush the data through the crypto stream into the memory stream
cs.Write(inputByteArray 0 inputByteArray.Length);
cs.FlushFinalBlock();
//建立StringBuild对象,CreateDecrypt使用的是流对象,必须把解密后的文本变成流对象
StringBuilder ret = new StringBuilder();
return System.Text.Encoding.UTF8.GetString(ms.ToArray());
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-01-07 08:12 lsb\
目录 0 2013-01-07 08:29 lsb\lsb\
文件 2878 2013-01-07 08:31 lsb\lsb\DES.cs
文件 811 2013-01-07 08:13 lsb\lsb\Form1.cs
文件 4296 2013-01-07 08:13 lsb\lsb\Form1.designer.cs
文件 95829 2013-01-07 08:13 lsb\lsb\Form1.resx
文件 6058 2013-01-07 09:46 lsb\lsb\LSB_em
文件 11176 2013-01-07 09:08 lsb\lsb\LSB_em
文件 62834 2013-01-07 09:08 lsb\lsb\LSB_em
文件 3266 2013-01-07 09:46 lsb\lsb\LSB_Extraction.cs
文件 10004 2013-01-07 09:08 lsb\lsb\LSB_Extraction.designer.cs
文件 135602 2013-01-07 09:08 lsb\lsb\LSB_Extraction.resx
文件 4291 2013-01-07 08:13 lsb\lsb\LSB算法CS实现.csproj
文件 476 2013-01-07 08:13 lsb\lsb\Program.cs
目录 0 2013-01-07 08:12 lsb\lsb\Properties\
文件 1398 2013-01-07 08:12 lsb\lsb\Properties\AssemblyInfo.cs
文件 2856 2013-01-07 08:12 lsb\lsb\Properties\Resources.Designer.cs
文件 5612 2013-01-07 08:12 lsb\lsb\Properties\Resources.resx
文件 1088 2013-01-07 08:12 lsb\lsb\Properties\Settings.Designer.cs
文件 249 2013-01-07 08:12 lsb\lsb\Properties\Settings.settings
文件 3502 2013-01-07 09:47 lsb\lsb\SevenZipUtil.cs
目录 0 2013-01-07 08:13 lsb\lsb\bin\
目录 0 2013-01-07 08:25 lsb\lsb\bin\Debug\
文件 1129472 2010-08-26 21:13 lsb\lsb\bin\Debug\7z.dll
文件 1484800 2010-08-26 21:11 lsb\lsb\bin\Debug\7z64.dll
文件 151040 2012-12-26 09:12 lsb\lsb\bin\Debug\SevenZipSharp.dll
文件 205824 2013-01-07 09:47 lsb\lsb\bin\Debug\lsb.exe
文件 52736 2013-01-07 09:47 lsb\lsb\bin\Debug\lsb.pdb
文件 11600 2013-01-07 09:46 lsb\lsb\bin\Debug\lsb.vshost.exe
目录 0 2013-01-07 09:48 lsb\lsb\bin\Release\
文件 4663 2013-01-07 08:31 lsb\lsb\lsb.csproj
............此处省略18个文件信息
- 上一篇:Modbus通讯协议-C#源码
- 下一篇:[C#源码]超市项目BS架构
相关资源
- C# 读取USB 信息
- c#读取txt(cs、html)文件
- 从PLC循环读取到前台显示,并推送给
- MvCodeReaderSDKNet海康相机SDK二次开发,
- C#源码读取DXF文件
- 电子秤重量读取(串口通讯)
- 数据采集卡读取(USB)
- unity读取Excel
-
xm
l文件解析(读取/写入) - 读取mdb输出到Excel
-
C#读取xm
l文件数据。显示在datagrid -
读取xm
l显示在dataGridView - 读取GY-25倾斜度模块数据
- TcpClient C#2010读取PLC
- 图片二进制读取数据库(附数据库)
- 文本读取与写入,byte[]和string类型
- 读取Excel表格内容到treeview
- USB读取PID和UID
- WPF窗口贴边自动隐藏
- 窗体的浮动及隐藏58524
- 读取文件夹下的note文本文件,编辑、
- 纯C#的DICOM读取和通讯
- Teigha读取DWG测试程序
- C#文件流读取CSV文件
- 读取大智慧数据开发
- C#使用Adobe Reader读取PDF
- C# 、.NET 读取AD域里用户名或组
- C#读取DXF文件并显示dxf转hpgl
- 安卓使用poi XWPFDocument读取及修改wor
- C# WPF实现读取显示DICOM
评论
共有 条评论