Today made a text encryption algorithm, because this algorithm is based on algorithm secrecy, no secret key, all can only meet the requirements of low security requirements,
Strout must be 0x20 for printable characters--0x7f//strout must end with '/',//encryption works better by sols//encryption result as printable character 0x20--0x7fvoid encodestr (char *strout) {int Randoffset = rand ()%96;int reschar; int i=0;for (; strout[i]! = ' i++ '; reschar) {Randoffset = Strout[i + I*17;//17] + can be used for other Appropriate number while (Reschar > 127) {Reschar-= 96;} Strout[i] = (char) Reschar;} strout[i++] = (char) (randoffset + +); Strout[i] = ' + ';} Strout must be 0x20 for printable characters--0x7f//strout must end With ' *strcode ', void Decodestr (char KeyIndex) {int 0;if = strcode[0 (
return;while (Strcode[keyindex]! = ' + ') {keyindex++;} int Key = (int) (strcode[keyindex-1])-32;int reschar; int i=0;for (; strcode[i]! = ' + '; i++) {Reschar = Strcode[i]-Key- I*17;while (Reschar < +) {Reschar + = 96;} Strcode[i] = (char) Reschar;} Strcode[i-1] = ' + ';}
C + + string encryption printable text encryption