C&C++   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了密码溢出大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在加密如下,但不知道如果它们移出范围,如何阻止大写字母进入其他符号,同样小写字母超出小写字母的范围.如何让它们围成一圈并停止溢出?谢谢
int size = strlen(plain_text);
int arrayelement = 0;
for(arrayelement = 0; arrayelement < size; arrayelement++)
{
    if (islower(plain_text[arrayelement]))
    {
        ciphered_text[arrayelement] = (int)(plain_text[arrayelement] + shiftkey);
    }
    else if (isupper(plain_text[arrayelement]))
    {
        ciphered_text[arrayelement] = (int)(plain_text[arrayelement] + shiftkey);
    }
}

ciphered_text[size] = '\0';
printf("%s",ciphered_text);

解决方法

我猜你使用像char这样的类型,这样就可以轻松解决不溢出问题
int tmp_ciphered = (my_char + shift) % 0xff;
char ciphered = (char)(tmp_ciphered);

然后你转身不要溢出,这是一个戒指

大佬总结

以上是大佬教程为你收集整理的密码溢出全部内容,希望文章能够帮你解决密码溢出所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:密码溢出