mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
decrypt function updated
This commit is contained in:
parent
827f7541c6
commit
31a1862b80
1 changed files with 11 additions and 1 deletions
|
@ -796,12 +796,17 @@ namespace xmreg
|
|||
|
||||
const size_t prefix_size = sizeof(chacha8_iv)
|
||||
+ (authenticated ? sizeof(crypto::signature) : 0);
|
||||
if (ciphertext.size() < prefix_size)
|
||||
{
|
||||
cerr << "Unexpected ciphertext size" << endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
crypto::chacha8_key key;
|
||||
|
||||
crypto::generate_chacha8_key(&skey, sizeof(skey), key);
|
||||
|
||||
const crypto::chacha8_iv &iv = *(const crypto::chacha8_iv*)&ciphertext[0];
|
||||
|
||||
std::string plaintext;
|
||||
|
||||
plaintext.resize(ciphertext.size() - prefix_size);
|
||||
|
@ -813,6 +818,11 @@ namespace xmreg
|
|||
crypto::public_key pkey;
|
||||
crypto::secret_key_to_public_key(skey, pkey);
|
||||
|
||||
const crypto::signature &signature =
|
||||
*(const crypto::signature*)&ciphertext[ciphertext.size()
|
||||
- sizeof(crypto::signature)];
|
||||
|
||||
|
||||
const crypto::signature &signature =
|
||||
*(const crypto::signature*)&ciphertext[ciphertext.size()
|
||||
- sizeof(crypto::signature)];
|
||||
|
|
Loading…
Reference in a new issue