登录
首页 » C# » DES加密解密/AES加密解密/RSA加密解密/SHA1/MD5 例子

DES加密解密/AES加密解密/RSA加密解密/SHA1/MD5 例子

于 2016-10-19 发布
0 270
下载积分: 1 下载次数: 0

代码说明:

DES加密解密/AES加密解密/RSA加密解密/SHA1/MD5 例子

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 用于解决著名的奶牛问题
    该算法用于解决著名的奶牛问题
    2013-08-13下载
    积分:1
  • QQ模拟登陆 源码下载
    QQ模拟登陆 源码下载
    2014-07-12下载
    积分:1
  • STM32F103系列IO操作-LED流水灯
    STM32F103系列IO操作-LED流水灯
    2020-02-18下载
    积分:1
  • winform窗体之间传值的实现 示例下载
    利用public属性实现winform窗体传值,具体示例见截图
    2012-12-24下载
    积分:1
  • GC 垃圾回收算法
      =1,2垃圾回收算法:    托管堆:CLR要求的资源从托管堆分配,任何对象只要没有应用程序的根引用它,都会在某个时刻被垃圾回收器回收 基于代的机制,提高回收的性能,在程序的生命期中,新建的对象是新一代,而创建的比较早的对象是老一代,第0代是最近分配的对象,CLR 使用了0,1,2三代进行管理 =3 GC和调试GcAndDebug.cs =4本地资源终结(finalization)是CLR提供的一种机制,允许对象在垃圾回收器回收其内存之前执行一些得体的清理工作,任何包装了本地资源的类型都必须支持终结操作(实现一个命名为Finalize的方法)。GC判断一个对象是垃圾时,会调用对象的Finalize(实现的情况下),C#中使用~ClassName表示FinalizeIn most cases, you do not need to write classes that derive from the CriticalFinalizerObject class. The .NET Framework class library provides two classes, SafeHandle and CriticalHandle, that provide critical finalization functionality for handle resources. Furthermore, the .NET Framework provides a set of prewritten classes derived from the SafeHandle class, and this set is located in the Microsoft.Win32.SafeHandles namespace. These classes are designed to provide common functionality for supporting file and operating system handles. System.Runtime.ConstrainedExecution 下的 CriticalFinalizerObject 抽象对象,CLR特殊对待 System.Runtime.InteropServices下的派生抽象类 SafeHandle CriticalHandle 和SafeHandle只是引用计数的区别Microsoft.Win32.SafeHandles  SafeFileHandle,SafeRegistryHandle ,SafeWaitHandle... SafeProcessHandle SafeLibraryHandle SafeLocalMemHandle SafeThreadHandle等MSDN没有编写,但同样是处理这个问题的 类似的实现的不同类代表不同的资源类型,这么多的类似,主要是为了类型安全SafeHandle的作用:1、以前的IntPtr形式不够健壮,如在IntPtr赋值前可能抛出ThreadAbortException异常,这样托管代码将造成本地资源的泄露2、防止利用潜在的安全漏洞,一个线程访问一个本地资源,另一个线程释放该资源,通过引用计数实现 对托管资源只有在极少数情况下才使用终结器 终结器被调用的时刻:1、第0代满:2、显式调用GC.Collect3、Windows报告内存不足4、CLR卸载AppDomain5、CLR关闭 内部实现使用终结列表保留对象,通过这个GC进行处理, freachable队列 =Dispose终结器的调用时间由GC确定,调用者无法显式调用它Dispose提供了显式清理资源的能力 GCHandle WeakReference System.Runtime.CompilerServices.ConditionalWeakTable 加入时的是对象的WeakReference,因此可能会回收,但可以确保只要key存在,value也是存在的 任何大于85000字节的对象被自动认为是大对象,大对象在大对象堆中分配 ==大量资源GCpublic static void AddMemoryPressure(Int64 bytesAllocated);   public static void RemoveMemoryPressure(Int64 bytesAllocated);提示GC实际需要消耗的内存,然后GC监视内存压力,压力变大时,强制回收 System.Runtime.InteropServices  HandleCollector 数量有限的本地资源 MemoryFailPoint在需要大量内存前可以先检查是否可以使用这么大的内存 GC的监视代码形式: GC.GetTotalMemory GC.CollectionCountPerMon.exe系统性能监视工具CLR Profiler工具FUSLOGVW.execlrver.exeSvcTraceViewer.exe
    2012-12-16下载
    积分:1
  • ADSL宽带拨号 (C#)实例源码下载
    实例截图: 部分源码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Lqarpjj.Study.Demo.ADLSTool.Class;using System.Diagnostics;using System.IO;using Microsoft.Win32;namespace Lqarpjj.Study.Demo.ADLSTool{ public partial class frmMain : Form { #region 自定义变量 /// /// 静态变量存储信息的地址文件 /// private static string ADSLPath = Application.StartupPath @"ADSL.ini"; private static string ConnectionsPath = Application.StartupPath @"create.vbs"; /// /// 定义Ini写入对象 /// private IniWrite ini = new IniWrite(ADSLPath); /// /// 判断第一登录 /// private bool IsFirst = true; /// /// /// private MD5.DES.Md5Class md5 = new MD5.DES.Md5Class(); /// /// /// public static string key = null; #endregion /// /// 构造函数 /// public frmMain() { InitializeComponent(); } #region 窗体事件 /// /// 窗体初始 /// /// /// private void frmMain_Load(object sender, EventArgs e) { SetToolTip(); IntiLoad(sender, e); } #endregion #region 控件按钮事件 /// /// 复制账号 /// /// /// private void btnCopyAccount_Click(object sender, EventArgs e) { if (this.chkSpecial.Checked)//判断特殊拨号是否勾选 { //进行加密 UsernameEncode encode = new UsernameEncode(); Clipboard.SetDataObject(encode.EncodeUsername(this.txtAccount.Text, this.txtPassword.Text)); } else { Clipboard.SetDataObject(this.txtAccount.Text); } MessageBox.Show("账号已经复制到剪贴板!", "复制成功"); } /// /// 拨号 /// /// /// private void btnDia_Click(object sender, EventArgs e) { if (this.txtAccount.Text.Trim() == "") { MessageBox.Show("账号不能为空", "输入错误"); txtAccount.Focus(); return; } if (this.txtPassword.Text.Trim() == "") { MessageBox.Show("密码不能为空", "输入错误"); txtPassword.Focus(); return; } this.NetDia(); } /// /// 找不到电话簿? /// /// /// private void lblNotFind_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { this.CreateConnections(); } /// /// 记住账号联动 /// /// /// private void chkRemAccount_CheckedChanged(object sender, EventArgs e) { if (!this.chkRemAccount.Checked) { this.chkRemPassword.Checked = false; } } /// /// 记住密码联动 /// /// /// private void chkRemPassword_CheckedChanged(object sender, EventArgs e) { if (this.chkRemPassword.Checked) { this.chkRemAccount.Checked = true; } } /// /// 自动登录启动 /// /// /// private void AutoConectTimer_Tick(object sender, EventArgs e) { this.AutoConectTimer.Enabled = false; new frmLinkInfo(this).Show(); base.Hide(); } #endregion #region 自定义方法 /// /// 初始登录 /// /// /// private void IntiLoad(object sender, EventArgs e) { FileInfo info = new FileInfo(ADSLPath); try { if (info.Exists) { this.ReadConfig(); } if (this.chkAutoDia.Checked)//是否自动登录 { this.AutoConectTimer.Start(); } } catch (Exception) { File.Delete(ADSLPath); this.frmMain_Load(sender, e); } } /// ///设置控件提示 /// private void SetToolTip() { ToolTip tip = new ToolTip(); tip.BackColor = System.Drawing.Color.Transparent; tip.SetToolTip(this.btnCopyAccount, "复制账号到剪贴板。如果勾选了特殊拨号,复制的则是加密过的账号。"); tip.SetToolTip(this.btnDia, "手动进行拨号。"); tip.SetToolTip(this.chkAutoDia, "勾选后,下次启动将自动拨号。"); tip.SetToolTip(this.chkSpecial, "如果你原本使用协同拨号器拨号,请勾选此项。"); tip.SetToolTip(this.chkRemPassword, "勾选后,将会保存密码信息,同时保存账号信息。"); tip.SetToolTip(this.chkRemAccount, "勾选后,将会保存账号信息,但不会保存密码信息。"); tip.SetToolTip(this.txtPassword, "在这里输入你的密码。如果有字母,有大小写之分。"); tip.SetToolTip(this.lblNotFind, "如果拨号时提示找不到电话簿,请点击这里。"); tip.SetToolTip(this.txtAccount, "在这里输入你的用户名,如果是特殊拨号不分大小写。"); tip.SetToolTip(this.chkAutoClo, "勾选后拨号成功将自动关闭程序,如果拨号失败,则不会自动关闭。"); } /// /// 写入配置信息 /// private void WriteConfig() { this.ini.Writue("用户设置", "记住账号", this.chkRemAccount.Checked.ToString()); this.ini.Writue("用户设置", "记住密码", this.chkRemPassword.Checked.ToString()); this.ini.Writue("用户设置", "特殊拨号", this.chkSpecial.Checked.ToString()); this.ini.Writue("用户设置", "自动连接", this.chkAutoDia.Checked.ToString()); this.ini.Writue("用户设置", "自动关闭", this.chkAutoClo.Checked.ToString()); this.ini.Writue("用户设置", "首次使用", this.IsFirst.ToString()); if (this.chkRemAccount.Checked) { this.ini.Writue("用户信息", "账号", this.md5.Encryption(this.txtAccount.Text)); this.ini.Writue("加密密钥", "账号", key); } if (this.chkRemPassword.Checked) { this.ini.Writue("用户信息", "密码", this.md5.Encryption(this.txtPassword.Text)); this.ini.Writue("加密密钥", "密码", key); } } /// /// 读取配置信息 /// private void ReadConfig() { this.chkRemAccount.Checked = bool.Parse(this.ini.ReadValue("用户设置", "记住账号")); this.chkRemPassword.Checked = bool.Parse(this.ini.ReadValue("用户设置", "记住密码")); this.chkSpecial.Checked = bool.Parse(this.ini.ReadValue("用户设置", "特殊拨号")); this.chkAutoDia.Checked = bool.Parse(this.ini.ReadValue("用户设置", "自动连接")); this.chkAutoClo.Checked = bool.Parse(this.ini.ReadValue("用户设置", "自动关闭")); this.IsFirst = bool.Parse(this.ini.ReadValue("用户设置", "首次使用")); if (this.chkRemAccount.Checked) { this.txtAccount.Text = this.md5.Decryption(this.ini.ReadValue("加密密钥", "账号"), this.ini.ReadValue("用户信息", "账号")); if (this.txtAccount.Text.Trim() == "") { this.txtAccount.Text = null; } } if (this.chkRemPassword.Checked) { this.txtPassword.Text = this.md5.Decryption(this.ini.ReadValue("加密密钥", "密码"), this.ini.ReadValue("用户信息", "密码")); if (this.txtPassword.Text.Trim() == "") { this.txtPassword.Text = null; } } } /// /// 判断是否是第一次使用本软件 /// private void IsFirstUse() { if (this.IsFirst) { if (MessageBox.Show("检测到您是初次使用本软件,是否自动创建一个名为【宽带连接】的连接?如果已经存在,请选否。", "初次使用", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.CreateConnections(); } this.IsFirst = false; this.WriteConfig(); } } /// /// 连接宽带 /// private void NetDia() { this.IsFirstUse(); new frmLinkInfo(this).Show(); base.Hide(); } /// /// 电话簿 /// private void CreateConnections() { Process[] processArray; StreamWriter writer = new StreamWriter(ConnectionsPath, false, Encoding.Default); writer.Write(this.GetVersion()); writer.Close(); Process process = new Process(); process.StartInfo.FileName = ConnectionsPath; process.StartInfo.CreateNoWindow = true; base.Hide(); process.Start(); process.WaitForExit(); File.Delete(ConnectionsPath); Label_006A: processArray = Process.GetProcesses(); foreach (Process process2 in processArray) { if (process2.ProcessName.ToString() == "rasphone") { goto Label_006A; } } base.Show(); } /// /// 获取版本? /// /// private string GetVersion() { StringBuilder str = new StringBuilder(); str.Append(""); str.Append("set ws=createobject("wscript.shell") "); str.Append(" ws.run "rasphone -a 宽带连接" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{t}" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{n}" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{enter}" "); str.Append(" wscript.sleep 200 "); str.Append(" ws.sendkeys "{enter}" "); if (Registry.LocalMachine.OpenSubKey(@"SoftwareMicrosoftWindows NTCurrentVersion").GetValue("ProductName").ToString() == "Windows 7 Ultimate") { str.Append(""); str.Append("set ws=createobject("wscript.shell")"); str.Append(" ws.run "rasphone -a 宽带连接""); str.Append(" wscript.sleep 200"); str.Append(" ws.sendkeys "{enter}""); str.Append(" wscript.sleep 200"); str.Append(" ws.sendkeys "{enter}""); } return str.ToString(); } #endregion }}
    2014-07-16下载
    积分:1
  • WCF完整的一个Demo
    1、这是一个完整的WCF的Demo,一共有3个应用程序所组成。2、 WCFService-Library2010---  WCF服务库 WebServicePerson---  Web Application用于应用WCF Service Library,方便在IIS中部署。 WebPerson---  Web Application(Web项目里如何去使用WCF的WebService)
    2015-02-27下载
    积分:1
  • IC卡二次开发实例
    IC卡二次开发实例
    2014-08-01下载
    积分:1
  • C#通过三菱MX控件读取FX系列PLC数据案例
    C#通过三菱MX控件读取FX系列PLC数据案例
    2019-12-12下载
    积分:1
  • 学堂在线+C++高级程序设计+郑莉+课程所有代码
    郑莉老师课程代码,解压后200多M
    2020-02-15下载
    积分:1
  • 696516资源总数
  • 106918会员总数
  • 4今日下载