『壹』 有没有知道怎样用C语言来写RSA加密算法的代码的谢谢

#region RSA的加密函数 //##############################################################################
//RSA 方式加密
//说明KEY必须是XML的行式,返回的是字符串
//在有一点需要说明!!该加密方式有 长度 限制的!!
//##############################################################################

//RSA的加密函数 string public string RSAEncrypt(string xmlPublicKey, string m_strEncryptString)
{

byte[] PlainTextBArray; byte[] CypherTextBArray;
string Result;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPublicKey);
PlainTextBArray = (new UnicodeEncoding()).GetBytes(m_strEncryptString);
CypherTextBArray = rsa.Encrypt(PlainTextBArray, false);
Result = Convert.ToBase64String(CypherTextBArray);
return Result;

} //RSA的加密函数 byte[]
public string RSAEncrypt(string xmlPublicKey, byte[] EncryptString)
{

byte[] CypherTextBArray; string Result;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPublicKey);
CypherTextBArray = rsa.Encrypt(EncryptString, false);
Result = Convert.ToBase64String(CypherTextBArray);
return Result;

} #endregion
#region RSA的解密函数 //RSA的解密函数 string
public string RSADecrypt(string xmlPrivateKey, string m_strDecryptString)
{
byte[] PlainTextBArray;
byte[] DypherTextBArray;
string Result;
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPrivateKey);
PlainTextBArray = Convert.FromBase64String(m_strDecryptString);
DypherTextBArray = rsa.Decrypt(PlainTextBArray, false);
Result = (new UnicodeEncoding()).GetString(DypherTextBArray);
return Result;

}
//RSA的解密函数 byte public string RSADecrypt(string xmlPrivateKey, byte[] DecryptString)
{
byte[] DypherTextBArray;
string Result;
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPrivateKey);
DypherTextBArray = rsa.Decrypt(DecryptString, false);
Result = (new UnicodeEncoding()).GetString(DypherTextBArray);
return Result;

} #endregion
#endregion

『贰』 用c语言设计了一个加密算法:用a代替z,用b代替y,用c代替x,……,用z代替a。

#include <stdio.h>

int main()
{
char s[100],*p;
printf("请输入字符串 : ");
gets(s);
p = s;
while(*p)
{
if((*p >= 'a') && (*p <= 'z')) /*处理小写*/
{
*p ='z' - *p + 'a';
}
if((*p >= 'A') && (*p <= 'Z')) /*处理大写,同理处理数字亦一样..自己例推*/
{
*p ='Z' - *p + 'A';
}

p++;
}
printf("转换后的字符串为 : %s\n\n",s);
return 0;
}