惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
Martin Fowler
Martin Fowler
爱范儿
爱范儿
IT之家
IT之家
Last Week in AI
Last Week in AI
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
aimingoo的专栏
aimingoo的专栏
G
Google Developers Blog
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
The Cloudflare Blog
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
腾讯CDC
Microsoft Security Blog
Microsoft Security Blog

博客园 - 流星石

水晶报表中如何改变报表的背景色、显示行数等。 如何动态生成水晶报表(ASP.NET) C编写的SQL Server 数据库连接通用类库 使用Facade模式分析 DreamWeaver MX 2004中 设为首页和加入收藏的实现 DreamWeaver MX 2004制作树状菜单 DreamWeaver MX 2004利用层进行下拉菜单的制作 Grove---------.NET中的ORM实现 在ASP.NET中写一个数据层基类-----DbObject 在ASP.NET页面中显示年月日和星期的代码实现 在ASP.NET中实现多文件上传 构建简单的Web Service服务 C#中写COM+组件 在ASP.NET 中实现Model-View-Controller 数据库操作源代码 asp.net中DataGrid双行跨列表头设计心得 用C#写一个Web自定义日期时间控件 C#.net常用函数和方法集 Together for .net建模入门
.NET下的加密编程
流星石 · 2005-07-22 · via 博客园 - 流星石

在.NET中可以加密所要使用的类全部都集中在system.security.cryptography它包含多种加密算法.

private sub Button1_click()

    Dim txt1 as Byte() '声明一个BYTE类型的变量。
    txt1=System.Text.AscIIEncoding.ASCII.GetBytes(TextBox1.Text) '读取输入文本,即要加密的文本。
    Dim key(16) as Byte
    key = System.Text.AscIIEncoding.ASCII.GetBytes(TextBox2.Text)'读取密码。
    Dim hma as new System.Security.cryptography.HMAcsHA1(key) '声明加密类,即使用何种加密方法。
    Dim csstream as new System.Security.cryptography.cryptostream(System.Io.stream.null,hma,security.cryptography.cryptostreammode.write) '进行加密转换。
    csstream.write(txt1,0,txt1.length)'将加密后的文本保存在TXT1这个变量中。
    csstream.close()
    TextBox3.text=System.Text.AscIIEnCoding.ASCII.GetString(hma.Hash)'显示加密文字。
End sub