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

推荐订阅源

N
News and Events Feed by Topic
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recorded Future
Recorded Future
Y
Y Combinator Blog
C
Check Point Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
小众软件
小众软件
F
Full Disclosure
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
博客园 - 司徒正美
量子位
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
T
Tenable Blog
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
Google Developers Blog
P
Proofpoint News Feed
T
Threatpost
Know Your Adversary
Know Your Adversary
aimingoo的专栏
aimingoo的专栏
Latest news
Latest news
Security Latest
Security Latest
Cyberwarzone
Cyberwarzone
A
About on SuperTechFans
P
Palo Alto Networks Blog
Stack Overflow Blog
Stack Overflow Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Hacker News
The Hacker News
A
Arctic Wolf
AWS News Blog
AWS News Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
NISL@THU
NISL@THU
Last Week in AI
Last Week in AI
Hacker News - Newest:
Hacker News - Newest: "LLM"
Spread Privacy
Spread Privacy
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Application and Cybersecurity Blog
Application and Cybersecurity Blog
I
InfoQ
J
Java Code Geeks
H
Help Net Security

博客园 - 戴玮

关于状态模式的思考 实在是忍受不了MSN的巨慢速度,重新换个地方 如果在网页中实现查找功能 asp.net2.0 页面生命周期方法 如何自定义一个模板列,并在后台加载 ASP.NET常用的代码集合 - 戴玮 - 博客园 触发器示例代码 ADO.NET2.0分页 - 戴玮 - 博客园 如何查找 Office Web 组件 (OWC) 编程文档和示例 如何将枚举定义翻译成DataTable 网页中调用MSN添加好友工具 如何在XP SP2下面使用DTC Javascript 复制与粘贴 - 戴玮 - 博客园 如何在Component中取得Page对象 使用TransactionScope进行COM+事务处理 - 戴玮 - 博客园 如何在C#中使用EVAL方法 - 戴玮 - 博客园 巨NB的JAVASCRIPT代码 - 戴玮 - 博客园 9月25日C#->WebService中如何传递文件 解决了一年多的问题,狂喜(一年之前)
C#加密与解决
戴玮 · 2006-11-15 · via 博客园 - 戴玮

using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;

namespace Secrituy
{
   
   

    public class Secure
    {
        private static byte[] DESKey = new byte[]{11,23,93,102,72,41,18,12};
        private static byte[] DESIV = new byte[] { 75, 158, 46, 97, 78, 57, 17, 36 };

        public static string Encode(string Encode_String)
        {
            DESCryptoServiceProvider objDES = new DESCryptoServiceProvider();
            MemoryStream objMemoryStream = new MemoryStream();
            CryptoStream objCryptoStream = new CryptoStream(objMemoryStream, objDES.CreateEncryptor(DESKey, DESIV), CryptoStreamMode.Write);
            StreamWriter objStreamWriter = new StreamWriter(objCryptoStream);
            objStreamWriter.Write(Encode_String);
            objStreamWriter.Flush();
            objCryptoStream.FlushFinalBlock();
            objMemoryStream.Flush();
            return Convert.ToBase64String(objMemoryStream.GetBuffer(), 0, (int)objMemoryStream.Length);
        }

        public static string Decode(string Encode_String)
        {
            DESCryptoServiceProvider objDES = new DESCryptoServiceProvider();
            byte[] input = Convert.FromBase64String(Encode_String);
            MemoryStream objMemoryStream = new MemoryStream(input);
            CryptoStream objCryptoStream = new CryptoStream(objMemoryStream, objDES.CreateDecryptor(DESKey, DESIV), CryptoStreamMode.Read);
            StreamReader objStreamReader = new StreamReader(objCryptoStream);
            return objStreamReader.ReadToEnd();
        }
    }
}

<SCRIPT language=JavaScript >
window.onbeforeunload = function ()
{
    // . . . 
    event.returnValue = "You will lose any unsaved content";
    // . . .   
}
</script>