Why is encryption so significant/difficult? [closed] - encryption

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm a total beginner to encryption and I don't really understand anything about it.
Let's say I had a file TOPSECRET.BIN. What if I just:
read file byte by byte
XOR each byte by 69
write "encrypted" data back into file
Sure it's simple, but how is anyone ever going to know how to decrypt that?

The main problem is that your ciphered text will still exhibit the hierarchical structure of the cleartext. So if the cleartext was english text, the same hierarchical structure you see in the english phrases will be in the ciphered message.

If you XOR each byte with 69, figuring it out will be as simple as just trying 256 bytes to XOR. Plus language structure can be used for cryptanalysis.
You can use XOR for perfect encryption, though. Just choose a random sequence of bytes with length equal to your text and XOR it byte by byte. The random bytes will be your key. However, it will be as hard to communicate this key securely as it would be the message itself. And if you reuse this key, it would be easy enough to analyze multiple encrypted messages to figure it out.

Related

How can I made a data encryption method? (SHA256, Base64, etc.) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I would love to make my own data encryption method like Base64 and such. (preferably in Python.)
Would it be secure if I assigned "a" to for say a random number between 1-100 and a random letter or such. (for example 53f) and other letters are combinations and its random. But then how would I make a decoder, sorry for the long question haha. Thanks!
Do not start by making your own encryption method. Start by reading Bruce Schneier's Memo to the Amateur Cipher Designer.
Then write your own versions of the simpler existing ciphers: Caesar, Vigenere, (both of historical interest) RC4, Feistel. That will help you with the structure of ciphers, particularly RC4 -- a stream cipher and Feistel -- a block cipher framework.
Base64 is not a cipher, as has been pointed out. It is a useful exercise to write your own Base64 encoder/decoder, though most modern languages include one in their library anyway. That exercise helps you practice bit manipulations.
When you have done all that, find an implementation of AES that you are happy using. Any cipher you devise will not be as secure as AES.

Why middle block of 3DES is decryption rather than encryption? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
hey can someone answer these 3 questions please
Why middle block of 3DES is decryption rather than encryption? 2. Suppose an error occurs in a block of ciphertext during transmission from the sender to
receiver. What effect will be observed on the recovered plaintext at the receiver? 3. Inclusion of salt in UNIX password scheme is the difficulty of guessing password by 4096. However, the salt value is stored in pain-text as same entry as ciphertext. The salt value is known to attacker and need not be guessed. Then why is it asserted that salt increases security?
It's decryption with a different key to the first encryption.
Decrypting with the wrong key will further convolute the output.
3DES is a feistel cipher structure, encryption and decryption are symmetrical.
The reason triple DES is of the form EDE is for one reason, and one reason only: to make it compatible with single DES - thanks to #James Polk

Space-efficient encryption/decryption? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
What would be the most space efficient way to encrypt some data such that the encrypted data satisfies any one of the following constraints:
1) Fits in 32 bytes or less of hexidecimal (64 characters)
2) Fits in 28 bytes or less utf-8 characters (28 characters)
3) Fits in a 64 bit unsigned integer
The goal is to encrypt some data (like user id + nonce) and store it publicly on a blockchain and then decrypt it later on a server. The storage requirements of the blockchain I'm using (Stellar memos -- https://www.stellar.org/developers/guides/concepts/transactions.html#memo).
I'm looking for space-efficient encryption algorithms, or some combination of encryption + lossless compression that could make it fit.
There will be two inputs to encrypt: a user id and a nonce -- let's just assume we can fit both inside of 25 characters.
Example:
encrypt("7863439|12343567") -> "385acd1ca0ab619b9f832025fa358b69"
decrypt("385acd1ca0ab619b9f832025fa358b69") -> "7863439|12343567"
Use AES-256 or Twofish-256 You will have 256 bit = 32 bytes. This fits your 1st requirement. Both are space efficient. Well it depends of course how you define "efficient".
Maybe you could use hashing instead of encryption. Hash your data and store it on a server. Finding input data that will collide with your stored hash is designed to be difficult. Use a strong hashing algorithm that outputs 32 bytes of data, and you're done.

using cryptographichash in Qt [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am making a program in Qt5.2.1 and in it I am using a text file to store some data. I would like to encrypt it and decrypt it inside the program and display the text stored in the file in a QPlainTextEdit ( or any other similar widget).
I searched and came across Qcryptographichash but i have no idea how to use it. I read somewhere that it does not provide a very secure encryption but that doesn't matter ( I am not expecting hackers to try and read this file).
So, could anyone guide me in the right direction, maybe even give me some code. :D
QCryptographic hash creates a hash from given data. That is a one-way process, so the it will not do what you want, namely encrypt the data in a form that can be retrieved via decryption.
You can read more about the difference between encryption and hashes here.
You need to research into possible encryption algorithms. To my knowledge, that's not something that is part of Qt.
It's a large area of on-going research; there are so many to choose from, as you can see here.

AES 256 in CTR mode [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
ctr mode makes it possible to use a block cipher as a stream cipher but how strong will be the encryption in this mode ?
Ultimately it depends what you mean by strong. For example from an encryption point of view, i.e. taking the ability of an attacker to decrypt your ciphertext without access to the key, it should be as strong as any other use of AES256 (there is some dicussion on differential analysis between individual cipher blocks with a known plain text but that would be a weakness of the encryption algorithm not of the CTR mode itself).
In the end whether CTR mode is appropriate will depends what you want to apply it to and how you implement it. A couple of things to bear in mind when using this mode would be:
The same nonce/counter sequence will create the same cipher stream therefore you must ensure you do not ever use the same values for a given key. Otherwise it might be possible for an attacker given a message with a known plain text to reuse the cipher stream to decrypt your current message).
As the stream cipher is XORed with the plain text it means that a 1 bit change in the ciphertext directly results in that bit changing in the decrypted data, therefore some sort of message integrity is paramount, most likely a HMAC so that an attacker cannot realistically generate the hash and correct that as well.

Resources