c语言加密解密程序编写

求这个解密的大概思路是什么呀
密码是1101010 100000 1001110 1010010 1100001 1001101 100000 1010100 1010111 1011000

img

第一个条件理解的不是很清楚,是不是只转换英文字母啊,小写a除外,后移是往小的方向移动,,
下面是我写的,可能是理解有出入,仅供参考,适当修改也许能帮到你。

#include<stdio.h>
#include<string.h>
#include<ctype.h>

void btoc(char *b)
{
    static char *set=" ";
    const int dig[8]= {1,2,4,8,16,32,64,128};
    char *p1,*p2,*p;
    int sum,i,j=0;

    char *res=(char *)malloc(strlen(b)+1);
    memset(res,'\0',strlen(b)+1);
    p2=res;

    p=strtok(b,set);
    while(p)
    {
        p1=p+strlen(p)-1;
        i=0,sum=0;
        while(p1>=p)
        {
            if(*p1=='1')
                sum+=dig[i];
            if(isupper(sum))
                sum=tolower(sum);
            else if(islower(sum))
                sum=toupper(sum);
            i++,p1--;
        }

        sprintf(p2++,"%c",sum);

        p=strtok(NULL,set);
    }
    strncpy(b,res,strlen(b)+1);
    free(res);
}

//斐波那契数列
int Fib(int n)
{
    if (n <= 2)
    {
        return 1;
    }
    else
    {
        return Fib(n - 1) + Fib(n - 2);
    }
}


int main()
{
    //""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    int pi[26];
    pi[0]=0;
    int len;
    
    char s[1024]="1101010  100000 1001110  1010010  1100001 1001101 100000  1010100 1010111 1011000";
    btoc(s);


    for(int i=2,j=1; i<27; i++,j++)
    {
        pi[j]=Fib(i)%26;
    }

    //是大写小写字母向前移,a和其它字符不变
    len=strlen(s);
    char *p1=s,*p2=s+len-1;
    while(p1<=p2)
    {
        if( isalpha(*p1) && *p1!='a')
        {
            if(islower(*p1))
            {
                *p1+=pi[*p1-'a'];
                if(*p1>'z')
                    *p1=*p1-'z'+'a'-1;
            }
            else if(isupper(*p1))
            {
                *p1+=pi[*p1-'A'];
                if(*p1>'Z')
                    *p1=*p1-'Z'+'A'-1;
            }
        }
        p1++;

    }
    puts(s);
    return 0;
}