/*********************************************************************************
|
* Copyright: (C) 2020 LingYun IoT System Studio
|
* All rights reserved.
|
*
|
* Filename: encrypto.c
|
* Description: This file
|
*
|
* Version: 1.0.0(2020年04月04日)
|
* Author: Guo Wenxue <guowenxue@gmail.com>
|
* ChangeLog: 1, Release initial version on "2020年04月04日 21时02分36秒"
|
*
|
********************************************************************************/
|
|
#include <stdio.h>
|
#include <string.h>
|
|
#include "encrypto.h"
|
|
int g_var = 0;
|
|
static int test(void)
|
{
|
return 0;
|
}
|
|
int encrypto(char *str, char *ciphertxt, int size)
|
{
|
int i;
|
|
test();
|
|
if(!str || !ciphertxt || size<strlen(str))
|
{
|
printf("%s:%d %s(): Invalid input arguments\n", __FILE__, __LINE__, __FUNCTION__);
|
return -1;
|
}
|
|
for(i=0; i<strlen(str); i++)
|
{
|
ciphertxt[i]=str[i]+1;
|
}
|
|
|
g_var ++;
|
|
return 0;
|
}
|
|
|
int decrypto(char *ciphertxt, char *text, int size)
|
{
|
int i;
|
|
if( !ciphertxt || !text || size<strlen(ciphertxt) )
|
{
|
printf("%s:%d %s(): Invalid input arguments\n", __FILE__, __LINE__, __FUNCTION__);
|
return -1;
|
}
|
|
for(i=0; i<strlen(ciphertxt); i++)
|
{
|
text[i]=ciphertxt[i]-1;
|
}
|
|
return 0;
|
}
|