Encrytp and Decrypt function in JS to Qt
Solved
General and Desktop
-
Hi,
I need help to convert below function to qt:// Encrypt const encrypt = (key, message) => { const cipher = crypto.createCipheriv('aes-128-ecb', key, null) cipher.setAutoPadding(false) const encryptedData = Buffer.concat([cipher.update(message), cipher.final()]) return encryptedData } // Decrypt const decrypt = (key, data) => { const decipher = crypto.createDecipheriv('aes-128-ecb', key, null) decipher.setAutoPadding(false) const decryptedData = Buffer.concat([decipher.update(data), decipher.final()]) return decryptedData }
-
@Damian7546 Take a look at https://github.com/bricke/Qt-AES
-
@jsulm looks good.
QByteArray crypt(QByteArray key, QByteArray message) { QAESEncryption encryption(QAESEncryption::AES_128, QAESEncryption::ECB); return encryption.encode(message, key); } QByteArray decrypt(QByteArray key, QByteArray data) { QAESEncryption encryption(QAESEncryption::AES_128, QAESEncryption::ECB); return encryption.decode(data, key); }
-