MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / Encrypt

Method Encrypt

src/wallet/crypter.cpp:74–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext) const
75{
76 if (!fKeySet)
77 return false;
78
79 // max ciphertext len for a n bytes of plaintext is
80 // n + AES_BLOCKSIZE bytes
81 vchCiphertext.resize(vchPlaintext.size() + AES_BLOCKSIZE);
82
83 AES256CBCEncrypt enc(vchKey.data(), vchIV.data(), true);
84 size_t nLen = enc.Encrypt(&vchPlaintext[0], vchPlaintext.size(), vchCiphertext.data());
85 if(nLen < vchPlaintext.size())
86 return false;
87 vchCiphertext.resize(nLen);
88
89 return true;
90}
91
92bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingMaterial& vchPlaintext) const
93{

Callers 4

EncryptSecretFunction · 0.45
EncryptWalletMethod · 0.45
TestEncryptSingleMethod · 0.45

Calls 3

resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TestEncryptSingleMethod · 0.36