New SimpleCrypt page
-
No the code is not in a repo, but I probably should put it on Gitorious or something like that.
For generating a key out of a string, I think I'd just use QCryptographic hash with MD5 or SHA-1, and create a 64 bit key out of the 16 (MD5) or 20 (SHA-1) bytes these generate. The key you need is 8 bytes, but reducing the 16 or 20 bytes to 8 is just a simple XOR or two away...
-
Hey there, I am new to Qt and just came across your work ... great work by the way... could you tell me where your updated work might be? like the latest one?
cuz I seem to have a problem with this one - https://www.gitorious.org/qtdevnet-wiki-mvc/qtdevnet-simplecryptiodevide/source/a170750960820be4230ea1aff85148fc41f0dcf3:
-
Hi Andre,
Thanks for the code. It is really useful.
But is there any way to find out whether the file is encrypted or not? I would like to know if the input file is encrypted or not, if yes, then only I will decrypt it.
Thanks in advance,
Vrushali -
Hi Andre,
an example how to check it You got directly in the code:@
if (version !=3) { //we only work with version 3
m_lastError = ErrorUnknownVersion;
qWarning() << "Invalid version or not a cyphertext.";
return QByteArray();
}
@But is very useful thing that if You send to decryp function non-encypted data it will return the same string.
-
Hi Andre,
an example how to check it You got directly in the code:@
if (version !=3) { //we only work with version 3
m_lastError = ErrorUnknownVersion;
qWarning() << "Invalid version or not a cyphertext.";
return QByteArray();
}
@But is very useful thing that if You send to decryp function non-encypted data it will return the same string.
-
I disagree. I don't think the class should return the cyphertext as the plaintext if the cyphertext could not be decrypted. I think that it is the responsibility of the application to keep the conceptually very different plaintext and cypher text separate. If you don't know if a text is a cyphertext or a plaintext, I think you have design issues.
If you really want, you can work around this yourself by simply checking the returned string and the last error, and then using the original plain text on decryption error. I wouldn't recommend that though.
-
I disagree. I don't think the class should return the cyphertext as the plaintext if the cyphertext could not be decrypted. I think that it is the responsibility of the application to keep the conceptually very different plaintext and cypher text separate. If you don't know if a text is a cyphertext or a plaintext, I think you have design issues.
If you really want, you can work around this yourself by simply checking the returned string and the last error, and then using the original plain text on decryption error. I wouldn't recommend that though.
-
I could have this situation only when im switching between debug/release mode, because I decidated not to enrypt files when Im working on debug mode, thus when I go back to release all my files are not encrypted. At the moment I check result, and if its empty I put the orginal string.
-
I could have this situation only when im switching between debug/release mode, because I decidated not to enrypt files when Im working on debug mode, thus when I go back to release all my files are not encrypted. At the moment I check result, and if its empty I put the orginal string.
-
I had the same problem, and substitute:
toAScii -> toLatin1
fromAScii -> fromASCIIWorks fine to me too,
Thanks for sharing the code.
-
I had the same problem, and substitute:
toAScii -> toLatin1
fromAScii -> fromASCIIWorks fine to me too,
Thanks for sharing the code.