how to decrypt a encrypted data?
-
wrote on 1 Nov 2018, 09:52 last edited by
I am trying to encrypt a data using the following code
QCryptographicHash::hash(ui->LE_Pwd->text().toLatin1().toHex(), QCryptographicHash::Sha256).toHex()
is there a way to decrypt the data ?
-
I am trying to encrypt a data using the following code
QCryptographicHash::hash(ui->LE_Pwd->text().toLatin1().toHex(), QCryptographicHash::Sha256).toHex()
is there a way to decrypt the data ?
@ManiRon: No
-
I am trying to encrypt a data using the following code
QCryptographicHash::hash(ui->LE_Pwd->text().toLatin1().toHex(), QCryptographicHash::Sha256).toHex()
is there a way to decrypt the data ?
wrote on 1 Nov 2018, 10:35 last edited by -
-
@JonB i need to decrypt the data as i want to display the user name so kindly provide any way
wrote on 1 Nov 2018, 10:43 last edited by JonB 11 Jan 2018, 10:45@ManiRon
Well, say https://wiki.qt.io/Simple_encryption_with_SimpleCrypt gives source code, though there's quite a bit of code. Or there's https://stackoverflow.com/questions/21885140/aes-256-encryption-in-c-and-qt-5. Google forqt symmetric encryption
orc++ symmetric encryption
. Or, if you don't really want "encryption" but only "obfuscation", and you want to be as quick & lazy as possible,xor encryption c++
. Depends what you want to achieve. -
I am trying to encrypt a data using the following code
QCryptographicHash::hash(ui->LE_Pwd->text().toLatin1().toHex(), QCryptographicHash::Sha256).toHex()
is there a way to decrypt the data ?
wrote on 1 Nov 2018, 11:33 last edited by@ManiRon
BTW, I note that what you want to encrypt seems to be a password. Often people assume they need to be able to later decrypt a password in order to validate it, but that is not the case. It depends on how you need to use the password:-
If you do need to decrypt the password, so that for example you can send it on as the original clear-text to somewhere else, then it is true you will need to be able to decrypt.
-
However, if you only need to validate it against something a user has just typed in to make it sure they have the right the password, you do not need to decrypt. In this common case, all you need to do is store the correct password encrypted via a deterministic algorithm, and then when the user enters a password for validation you encrypt that proposed password using the same algorithm and then just compare that encryption against the one stored for equality. This is how passwords are typically stored in, say, a "provide your password to logon" --- there is no need/ability for a program to be able to decrypt back to the original password (which would be a security issue), it only needs to know whether the proposed password matches the stored one or not.
-
-
@ManiRon
BTW, I note that what you want to encrypt seems to be a password. Often people assume they need to be able to later decrypt a password in order to validate it, but that is not the case. It depends on how you need to use the password:-
If you do need to decrypt the password, so that for example you can send it on as the original clear-text to somewhere else, then it is true you will need to be able to decrypt.
-
However, if you only need to validate it against something a user has just typed in to make it sure they have the right the password, you do not need to decrypt. In this common case, all you need to do is store the correct password encrypted via a deterministic algorithm, and then when the user enters a password for validation you encrypt that proposed password using the same algorithm and then just compare that encryption against the one stored for equality. This is how passwords are typically stored in, say, a "provide your password to logon" --- there is no need/ability for a program to be able to decrypt back to the original password (which would be a security issue), it only needs to know whether the proposed password matches the stored one or not.
-
-
wrote on 2 Nov 2018, 08:19 last edited by
@ManiRon said in how to decrypt a encrypted data?:
want to encrypt both password
Very easy to understand yet informative: https://www.youtube.com/watch?v=8ZtInClXe1Q
1/10