国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

最簡單的字符串加密C#實現-移位加密

2024-07-21 02:25:01
字體:
來源:轉載
供稿:網友
 

/*
  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;
   
  }
}


菜鳥學堂:
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 错那县| 三台县| 安丘市| 张家口市| 裕民县| 客服| 鄯善县| 神池县| 达孜县| 修文县| 洞口县| 富锦市| 北辰区| 威海市| 平阳县| 彭水| 繁昌县| 临安市| 耒阳市| 出国| 青河县| 赫章县| 连江县| 涡阳县| 轮台县| 瑞金市| 雅安市| 灵石县| 应用必备| 九龙县| 宜兴市| 独山县| 会昌县| 勐海县| 钟祥市| 武陟县| 龙山县| 始兴县| 安多县| 荆门市| 洮南市|