Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I'm having trouble understanding how an encryption key works.

for example: if the word was 'hello' its encrypted value could be 'GHSSDgsd2', what would happen to the encrypted value if the key was 'dog'? how would it change the encrypted value of 'hello'?

share|improve this question

closed as too broad by TildalWave, Xander, Steve, Adnan, Terry Chia Jan 12 at 3:55

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Could you please give us a bit more details ? What encryption algorithm are you talking about ? –  Antoine Pinsard Jan 11 at 20:47

4 Answers 4

For all we know the key is "dog".

You didn't say what the key is, or what the encryption algorithm is; the only information given is the cleartext, "hello", and the ciphertext, "GH6SDgsd2".

If the cleartext is changed, the resulting ciphertext will change.

If the key is changed, the resulting ciphertext will change and, again, there's no telling what the resulting ciphertext will be without knowing 1) the key, and 2) the algorithm.

Encryption software works by first converting the cleartext to a series of numbers (in a computer, text is always stored as a series of numbers). Then, the software performs one or more mathematical operations on these numbers, the operations performed depend on the encryption algorithm used by the encryption software. Common encryption algorithms include AES, Blowfish, etc. The key is a separate series of characters, or numbers, that are also used in these mathematical operations. If the same cleartext, the same key, and the same algorithm and encryption software are used, the resulting ciphertext will be the same.

Ciphertext is sent as a secret message to someone. If the receiver of the message knows the ciphertext, the key, and the encryption algorithm and software, the receiver will be able to decode the message.

If someone in possession of the ciphertext doesn't know the key, or what encryption algorithm is being used, they won't be able to decode the message, or at best it will be very difficult for them to decode the message. The difficulty involved in attempting to decode a given piece of ciphertext, without having the key, depends primarily on the length of the key. If the key is long enough, it might take many years for someone to decode the message.

share|improve this answer
    
This is a reasonable high-level overview of symmetric encryption. You may wish to edit to include the fact that it ONLY addresses symmetric crypto, and that your statements of security assume correct implementation details. (No use of ECB, no re-use of IVs, etc.) –  Jonathan Garber Jan 11 at 21:14
1  
I stand by this answer as it is tailored to the knowledge level of the OP. I don't want to confuse the OP or attempt to dazzle him with brilliance. If OP wants to drill down into the topics you mentioned, there are ample resources out there. –  user35648 Jan 11 at 21:26

Think of encryption as a mathematical function (because it is): encrypted_text = F(key, plain_text). the result of the function depends on its inputs. In this case there are two: the plain text and the key. If you change either one, the output changes. So if you encrypt "hello" with the key "dog" you get one output -- azsxdcdv, but if you use a different key, "cat", you will get something else.

The idea of a key is that the algorithm (function) is well-known to everyone. So anyone can perform the encryption (and decryption) using the algorithm, but you need the correct key to decrypt and get the plain text.

share|improve this answer

A cryptographic hash function converts your password (for example) into something else that looks nothing like your password. It is a one-way process: if you start with the result you can't get your password out by "going in reverse." So, what use is it? It helps validate whether you know a password without storing your password. We hear all-too-frequently about web sites that were "hacked" and the passwords were revealed. This simply cannot happen unless the passwords are being stored. If a site stores the "Results" of the cryptographic hash algorithm instead of the password itself, then the site can run the same algorithm on the password you enter on its login page and compare the result with the one they stored for your account. If the results match, you must have entered the correct password, because that is the only way to get that result. The site can know you know your password without itself storing your password.

There are other kinds of encryption for other purposes, but what they have in common is the ability to transform data and thereby protect it. This implies something like the above: that someone who is supposed to have access to it can provide a small amount of data to unlock what was protected nd gain access to the unencrypted form. It is supposed to be "impossible" to guess that small amount of data, but don't bet on it. We should not just assume that modern https is completely secure.

A lot of clever people continue to push the edge of mathematics and cryptography to try to stay ahead of the curve, so that available encryption techniques continue to protect private data. However, it is kind of like bacteria and antibiotics: it requires vigilant evolution in cryptography to keep data private. A lot of clever people are also doing all they can and applying staggering computer resources to reversing cryptographic hashes, or using brute force to guess passwords at astronomical speeds.

This stuff matters: if privacy is to have any hope of survival in our world, effective encryption is its last defense.

share|improve this answer

You may have heard the term "everything in a computer is zeroes and ones." Thus, any data that you may want to encrypt that is on a computer is a list of numbers.

Data is encrypted by running each unit (byte, octet, packet, etc.) of data through an algorithm.

An algorithm is just a mathematical equation or process, that uses the key in this process - typically it is a program or part of a program that runs, though it can be a piece of hardware. If you give the algorithm plaintext and a specific key, you get ciphertext. If you give the algorithm ciphertext and that same key, you get your plaintext back.

Examples of algorithms are 3DES, MD5, SHA-1, etc.

So, if you use the wrong key, you don't get your plaintext back, but meaningless data.

The exact thing it will change it to depends on the algorithm.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.