Go to the SVN repository for this file.
34 #include "../ncbi_ansi_ext.h" 35 #include "../ncbi_priv.h" 37 #ifdef HAVE_LIBNCBICRYPT 38 # include <ncbicrypt.h> 47 #define NCBI_USE_ERRCODE_X Connect_Crypt 54 #ifdef HAVE_LIBNCBICRYPT 55 returnNCBICRYPT_Version(
version);
65 #ifdef HAVE_LIBNCBICRYPT 80 #ifdef HAVE_LIBNCBICRYPT 81 intres = NCBICRYPT_Free((NCBICRYPT_Key)
key);
100 #ifdef HAVE_LIBNCBICRYPT 101 if(!(res = NCBICRYPT_EncodeString((NCBICRYPT_Key)
key,
str))) {
103 if(
error== EINVAL) {
124 #ifdef HAVE_LIBNCBICRYPT 125 if(!(res = NCBICRYPT_DecodeString((NCBICRYPT_Key)
key,
str))) {
133(
"[CRYPT_Decode] Unknown ciphertext version `%c'",
152 #ifdef HAVE_LIBNCBICRYPT 158NCBICRYPT_Key
tmp= NCBICRYPT_Init(
key);
160=
tmp== NCBICRYPT_BAD_KEY ? 0 : NCBICRYPT_EncodeString(
tmp,
str);
161NCBICRYPT_Free(
tmp);
169NCBICRYPT_Key
tmp= NCBICRYPT_Init(
key);
171=
tmp== NCBICRYPT_BAD_KEY ? 0 : NCBICRYPT_DecodeString(
tmp,
str);
172NCBICRYPT_Free(
tmp);
181 extern char*
NcbiCrypt(
const char* s,
const char* k)
183 static const charkHex[] =
"0123456789ABCDEF";
184 size_tslen, klen,
i, j;
192 if(!(d = (
char*)
malloc((slen << 1) + 2)))
197 for(
i= 0, j = 0;
i< slen; ++
i, ++j) {
202*pd++ = kHex[c >> 4];
203*pd++ = kHex[c & 0x0F];
206 assert(((
size_t)(pd - d)) & 1);
214 unsigned char b= c -
'0';
217 b= (c |
' ') -
'a';
218 return b< 6 ?
b+ 10 :
'\xFF';
224 size_tslen, klen,
i, j;
239(
"[CRYPT_Decode] Unknown ciphertext version `%c'",
240 isalnum((
unsigned char)(*s)) ? *s :
'?'));
245 if(!(d = (
char*)
malloc(slen + 1)))
249 for(
i= 0, j = 0;
i< slen; ++
i, ++j) {
250 unsigned charhi, lo;
258*pd++ = ((hi << 4) | lo) ^ k[j];
265 assert((
size_t)(pd - d) == slen);
static const char * str(char *buf, int n)
const string version
version string
const struct ncbi::grid::netcache::search::fields::KEY key
CRYPT_Key CRYPT_Init(const char *key)
static unsigned char s_FromHex(char c)
char * CRYPT_EncodeString(CRYPT_Key key, const char *str)
char * CRYPT_DecodeString(CRYPT_Key key, const char *str)
char * NcbiCrypt(const char *s, const char *k)
int CRYPT_Version(int version)
char * NcbiDecrypt(const char *s, const char *k)
void CRYPT_Free(CRYPT_Key key)
struct SCRYPT_KeyTag * CRYPT_Key
#define CORE_LOGF(level, fmt_args)
#define CORE_LOG_X(subcode, level, message)
#define CORE_LOG(level, message)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4