Browse Source

"Decrypt" unencrypted

jl777
jl777 7 years ago
parent
commit
5d49880f4d
  1. 9
      iguana/exchanges/LP_privkey.c

9
iguana/exchanges/LP_privkey.c

@ -571,6 +571,8 @@ uint8_t *JPG_decrypt(uint16_t *indp,int32_t *recvlenp,uint8_t space[JPG_ENCRYPTE
int32_t LP_opreturn_decrypt(uint16_t *ind16p,uint8_t *decoded,uint8_t *encoded,int32_t encodedlen,char *passphrase)
{
bits256 privkey; int32_t msglen; uint8_t *extracted,space[JPG_ENCRYPTED_MAXSIZE + crypto_box_ZEROBYTES];
if ( passphrase != 0 && passphrase[0] != 0 )
{
vcalc_sha256(0,privkey.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase));
msglen = ((int32_t)encoded[1] << 8) | encoded[0];
*ind16p = ((int32_t)encoded[3] << 8) | encoded[2];
@ -580,6 +582,13 @@ int32_t LP_opreturn_decrypt(uint16_t *ind16p,uint8_t *decoded,uint8_t *encoded,i
return(msglen);
} else return(-1);
}
else
{
*ind16p = calc_crc32(0,extracted,encodedlen);
memcpy(decoded,extracted,encodedlen);
return(encodedlen);
}
}
int32_t LP_opreturn_encrypt(uint8_t *dest,int32_t maxsize,uint8_t *data,int32_t datalen,char *passphrase,uint16_t ind16)
{

Loading…
Cancel
Save