| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3593 人关注过本帖
标题:凯撒密码-移位密码C#算法实现
只看楼主 加入收藏
chtml小兵
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:126
专家分:314
注 册:2011-10-3
结帖率:63.64%
收藏
已结贴  问题点数:20 回复次数:9 
凯撒密码-移位密码C#算法实现
凯撒密码简介:

凯撒密码作为一种最为古老的对称加密体制,在古罗马的时候都已经很流行,他的基本思想是:通过把字母移动一定的位数来实现加密和解密。例如,如果密匙是把明文字母的位数向后移动三位,那么明文字母B就变成了密文的E,依次类推,X将变成A,Y变成B,Z变成C,由此可见,位数就是凯撒密码加密和解密的密钥。    它是一种代换密码。据说恺撒是率先使用加密函的古代将领之一,因此这种加密方法被称为恺撒密码。   在密码学中,恺撒密码(或称恺撒加密、恺撒变换、变换加密)是一种最简单且最广为人知的加密技术。它是一种替换加密的技术,明文中的所有字母都在字母表上向后(或向前)按照一个固定数目进行偏移后被替换成密文。例如,当偏移量是3的时候,所有的字母A将被替换成D,B变成E,以此类推。这个加密方法是以恺撒的名字命名的,当年恺撒曾用此方法与其将军们进行联系。 恺撒密码通常被作为其他更复杂的加密方法中的一个步骤,例如维吉尼亚密码。恺撒密码还在现代的ROT13系统中被应用。但是和所有的利用字母表进行替换的加密技术一样,恺撒密码非常容易被破解,而且在实际应用中也无法保证通信安全。
程序代码:
StringBuilder sb = new StringBuilder();//用来保存计算后的密文或者明文
                        string k;//用来保存密钥
                        string m;//明文或者密文
                        int resultLN;//保存字母对应的数值
程序代码:
#region 循环
                        for (int i = 0; i < m.Length; i++)
                        {
                            switch (m[i].ToString())
                            {
                                #region 大写
                                #region A
                                case "A":
                                    {
                                        resultLN = (0 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region B
                                case "B":
                                    {
                                        resultLN = (1 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion

                                #region C
                                case "C":
                                    {
                                        resultLN = (2 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion

                                #region D
                                case "D":
                                    {
                                        resultLN = (3 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion

                                #region E
                                case "E":
                                    {
                                        resultLN = (4 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion

搜索更多相关主题的帖子: 密码学 加密 罗马 
2012-01-05 02:17
chtml小兵
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:126
专家分:314
注 册:2011-10-3
收藏
得分:0 
程序代码:
                                #region F
                                case "F":
                                    {
                                        resultLN = (5 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region G
                                case "G":
                                    {
                                        resultLN = (6 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region H
                                case "H":
                                    {
                                        resultLN = (7 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region I

做个程序员吧,在里面找到万千对象~~~~~~
百名书阁(bmbook.5d6d)__最全IT图书免费下载中心
net图书资料/软件工具大全____免费!!!
各种编程语言教程应有尽有
2012-01-05 02:17
chtml小兵
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:126
专家分:314
注 册:2011-10-3
收藏
得分:0 
程序代码:
case "I":
                                    {
                                        resultLN = (8 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region J
                                case "J":
                                    {
                                        resultLN = (9 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region K
                                case "K":
                                    {
                                        resultLN = (10 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region L
                                case "L":
                                    {
                                        resultLN = (11 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region M
                                case "M":
                                    {
                                        resultLN = (12 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region N

做个程序员吧,在里面找到万千对象~~~~~~
百名书阁(bmbook.5d6d)__最全IT图书免费下载中心
net图书资料/软件工具大全____免费!!!
各种编程语言教程应有尽有
2012-01-05 02:19
chtml小兵
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:126
专家分:314
注 册:2011-10-3
收藏
得分:0 
程序代码:
case "N":
                                    {
                                        resultLN = (13 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region O
                                case "O":
                                    {
                                        resultLN = (14 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region P
                                case "P":
                                    {
                                        resultLN = (15 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region Q
                                case "Q":
                                    {
                                        resultLN = (16 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region R

做个程序员吧,在里面找到万千对象~~~~~~
百名书阁(bmbook.5d6d)__最全IT图书免费下载中心
net图书资料/软件工具大全____免费!!!
各种编程语言教程应有尽有
2012-01-05 02:21
chtml小兵
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:126
专家分:314
注 册:2011-10-3
收藏
得分:0 
程序代码:
case "R":
                                    {
                                        resultLN = (17 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                               
                               
                                #region S
                                case "S":
                                    {
                                        resultLN = (18 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region T
                                case "T":
                                    {
                                        resultLN = (19 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region U
                                case "U":
                                    {
                                        resultLN = (20 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region V
                                case "V":
                                    {
                                        resultLN = (21 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                

做个程序员吧,在里面找到万千对象~~~~~~
百名书阁(bmbook.5d6d)__最全IT图书免费下载中心
net图书资料/软件工具大全____免费!!!
各种编程语言教程应有尽有
2012-01-05 02:22
chtml小兵
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:126
专家分:314
注 册:2011-10-3
收藏
得分:0 
程序代码:
#region W
                                case "W":
                                    {
                                        resultLN = (22 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region X
                                case "X":
                                    {
                                        resultLN = (23 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region Y
                                case "Y":
                                    {
                                        resultLN = (24 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #region Z
                                case "Z":
                                    {
                                        resultLN = (25 + Int32.Parse(k))%26;
                                        switch (resultLN)
                                        {
                                            case 0:
                                                sb.Append("A");
                                                break;
                                            case 1:
                                                sb.Append("B");
                                                break;
                                            case 2:
                                                sb.Append("C");
                                                break;
                                            case 3:
                                                sb.Append("D");
                                                break;
                                            case 4:
                                                sb.Append("E");
                                                break;
                                            case 5:
                                                sb.Append("F");
                                                break;
                                            case 6:
                                                sb.Append("G");
                                                break;
                                            case 7:
                                                sb.Append("H");
                                                break;
                                            case 8:
                                                sb.Append("I");
                                                break;
                                            case 9:
                                                sb.Append("J");
                                                break;
                                            case 10:
                                                sb.Append("K");
                                                break;
                                            case 11:
                                                sb.Append("L");
                                                break;
                                            case 12:
                                                sb.Append("M");
                                                break;
                                            case 13:
                                                sb.Append("N");
                                                break;
                                            case 14:
                                                sb.Append("O");
                                                break;
                                            case 15:
                                                sb.Append("P");
                                                break;
                                            case 16:
                                                sb.Append("Q");
                                                break;
                                            case 17:
                                                sb.Append("R");
                                                break;
                                            case 18:
                                                sb.Append("S");
                                                break;
                                            case 19:
                                                sb.Append("T");
                                                break;
                                            case 20:
                                                sb.Append("U");
                                                break;
                                            case 21:
                                                sb.Append("V");
                                                break;
                                            case 22:
                                                sb.Append("W");
                                                break;
                                            case 23:
                                                sb.Append("X");
                                                break;
                                            case 24:
                                                sb.Append("Y");
                                                break;
                                            case 25:
                                                sb.Append("Z");
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                    break;
                                #endregion
                                #endregion

做个程序员吧,在里面找到万千对象~~~~~~
百名书阁(bmbook.5d6d)__最全IT图书免费下载中心
net图书资料/软件工具大全____免费!!!
各种编程语言教程应有尽有
2012-01-05 02:23
chtml小兵
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:126
专家分:314
注 册:2011-10-3
收藏
得分:0 
这是我最近在练手的一个程序的部分算法代码,等完成了软件成品发出来给大家共享一下!

还有高手帮我看一下,这个算法有没有更简单的实现方法,我总感觉这好像有点麻烦!

做个程序员吧,在里面找到万千对象~~~~~~
百名书阁(bmbook.5d6d)__最全IT图书免费下载中心
net图书资料/软件工具大全____免费!!!
各种编程语言教程应有尽有
2012-01-05 02:24
wypdragon
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:29
专家分:110
注 册:2011-11-19
收藏
得分:10 
谢谢lz,学习学习
2012-01-05 08:51
yhlvht
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:36
帖 子:707
专家分:4405
注 册:2011-9-30
收藏
得分:10 
StringBuilder sb = new StringBuilder();//用来保存计算后的密文或者明文
string k = "3";//用来保存密钥
string m = "ABCDEFGHIXYZ";//明文或者密文

for (int i = 0; i < m.Length; i++)
{
    sb.Append((char)(((int)m[i] - (int)'A' + Int32.Parse(k)) % 26 + (int)'A'));
}
按你的算法改写了一下,但只是考虑了往后移,没有考虑往前移(即k为负数的情况)
2012-01-05 12:57
炫色流年
Rank: 2
等 级:论坛游民
帖 子:61
专家分:18
注 册:2011-8-8
收藏
得分:0 
写这谢代码的人会被自己搞晕。。。

代码写得不错

学习学习
2012-01-20 23:45
快速回复:凯撒密码-移位密码C#算法实现
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.125233 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved