Simply encrypt a string in C

前端 未结 7 697
故里飘歌
故里飘歌 2020-12-16 04:47

I\'m trying to encrypt a query string on a game I\'m making when opening a url. It doesn\'t have to be complicated, in fact since I\'m working from a game engine it needs to

7条回答
  •  余生分开走
    2020-12-16 05:11

    You can do it with a very simple function:

    void encrypt(char *s)
    {
        int i, l = strlen(s);
        for(i = 0; i < l; i++)
            s[i] -= 15;
    }
    

    There's also a simple encryption algorithm you may be interested in, it's called XOR cipher.

提交回复
热议问题