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

推荐订阅源

罗磊的独立博客
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
量子位
博客园 - 三生石上(FineUI控件)
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
V2EX
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
Jina AI
Jina AI
L
LangChain Blog
M
MIT News - Artificial intelligence
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学

博客园 - winglzz

高手经验谈 招牌net程序员(包吃住有电话,冰箱等)工作地点上海 SQL注入 用asp.net写的论坛程序 ASP.NET中如何防范SQL注入式攻击 .NET 专题-安全-SQL注入攻击 经典的导航二级式导航菜单增强版 asp.net中的联动菜单 ASP.NET中树形图的实现 WEB应用程序中的进度条 C#中英文语音合成与中文语音识别技术 ASP.NET实现投票结果的图片进度条显示 几个漂亮的Button的CSS 使用C#在进度条中显示复制文件的进度 Net 下安装、调试的常见问题与错误!!! ASP.NET中的事务处理和异常处理 三层Web体系结构里的两种数据绑定模式 C#非对称加密程序 C#MD5算法
C#实现-移位加密
winglzz · 2007-03-26 · via 博客园 - winglzz

/*
  Filename: encrypt_string.cs
  Author : zhanghua
  Date  : 2005-08-11
  Fuction : input a strig  and encrypt a string
            加密后的字符串的第一个字符是原先字符串的最后一个字符,
            其余的每一个字符是对应的原字符串中的前一个字符的值加
            上3。
            example: welcome -> ezhofrp
        
*/
using System;

class Test
{
 public static void Main()
 {
  string strInput, strOutput;
  
  Console.WriteLine("please input a string to encrypt: \n");
  strInput=Console.ReadLine();

  
  Console.WriteLine(" your input string is : {0}\n", strInput);
   //Encrypt(strInput);
  
  strOutput = Encrypt(strInput);
 
   Console.WriteLine("strOutput is :{0}\n", strOutput);
 }
  
  private static string  Encrypt(string  strInput)
  {
   string strFont,  strEnd;
   string strOutput;
   char[] charFont;
   int i,len, intFont;
   
   len = strInput.Length;
   //Console.WriteLine(" strInput 's length is :{0} \n", len);
   strFont = strInput.Remove(len-1,1);                                 
   strEnd= strInput.Remove(0, len-1);                                 
                                
   //Console.WriteLine(" strFont is : {0} \n" , strFont);                                 
   //Console.WriteLine(" strEnd is : {0} \n" , strEnd);                                 
                                 
     charFont = strFont.ToCharArray();                                 
   for(i=0; i<strFont.Length; i++)                                 
   {                                 
    intFont = (int)charFont[i] + 3;                                 
    //Console.WriteLine(" intFont is : {0} \n", intFont);                                 
                                     
    charFont[i]= Convert.ToChar(intFont);                                   
    //Console.WriteLine("charFont[{0}] is : {1}\n", i, charFont[i]);                                 
   }
     strFont = ""; //let strFont  null
   for (i=0; i<charFont.Length; i++)
   {
      strFont += charFont[i];
    } 
     strOutput=strEnd + strFont;
     return strOutput;
   
  }
}