Encryption or hashing clarification - encryption

I am learning about encryption and hashing and how it works and I saw this as an example for a multiple choice:
sha256:1000:Om7yaZJtN8Ja1d+ogWGSz279wrh8hU6Q:w/yQtfpNEOosSLCjLzg131jxXJ5018WU
I'm confused on that the first two portions represent?
Is this a sha256 encryption? I counted 65 characters and I believe sha256 has 64.
Can anyone shed some light on what example I have here?

Related

Finding the kind of encryption used

I am trying to work out what kind of encryption and / or encoding is used on some data.
At first I thought it was some kind of AES CFB encryption but I can't seem to extract anything meaningful by decrypting that way.
Was wondering if anyone knows any way to find out?
Encrypted Data
EScRJxEnEScRJxEnEScRJ+UqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRTlKhUU5SoVFOUqFRQNKwsUhStHFBEslxTjLPsUfS6vFZUvExZnME8WOTF3FtkxnxYVMp8WKTKfFj0ynxY9Mp8WPTKfFj0ynxY9Mp8WPTKfFj0ynxY9Mp8WPTKfFj0ynxY9Mp8WPTKfFj0ynxY9Mp8WPTKfFj0ynxY9MoEWPTJjFj0yYxY9MkUWPTJFFj0yRRY9MkUWPTJFFj0yRRY9MkUWPTJFFj0yRRY9MkUWPTJFFj0yRRY9MkUWPTJFFj0yRRY9MkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRRYfMkUWHzJFFh8yRR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ZJAlOLizLTSgwDk3nM/ZLrTVLS1c2sUrtNstJATcXSac2HUgXNclGkTPjRbsx6UQJL59DiSyRQkEpUUHrJOk/Xx9tPqUVCzwDDZ85CQcFOIQC2jSXARUyNgG1MP8Azy/dADkvzADoLsQAvi7BAK8uvwCRLr8AQS7dAJMsGQEDKw8B4SkFAfsoBQGDKAUBRygFAUcoyQBHKMkARyirAEcoqwBHKKsAWyirAIMolwBVKdMAlSo3AVcswwFLLk8C2y/HAokxUwMFM8sDgTRhBIk2MwWROL8FhToPBpM7XQZtPI0Gtzy1BvM8PQe2PaAHPz7+B7w+MQj/Pj4IED9TCA0/UwgNP3sINT+rCu1A+w/BRGccv0vaLLNNDT1bRwxHfz2zS6I0Vk3lLt9NjCseTg8oH05LJhlOiyUSTuskA04MJANODCQDTgwkA04MJANODCQDTgwkA04MJANODCQDTgwkA04MJGNNdSJFTREiRU0RIkVNESJFTeMiAE4/KnBLUDXlRQ8/skCMRJ4+O0atPetGmT36RtY9z0YtPo9Gez5WRuA+CUYZP91Fjj+ARR1AC0WQQKlE60BZRHlB2kP9QV9Dl0LJQhxDQkK2Q6BBf0TAQJNFKz8fRtM8M0aLOa1E1zPrQtsvZUELLdU/bSr7PBcmDTrVIQ==
Seed
f206d6a4-b0f2-4352-ad72-7780da90f4e1

Cracking a sha256 hash and i know how it will be like

I have a sha256 hash and i know that it consists on numbers and small characters and the length is 64 so is there any way to crack it?
SHA256 is a one-way hash, rather than an encryption. As such, you can't decrypt it. You can, however, bruteforce it.
MD5Decrypt has already covered more than 3 billion possible SHA256 strings, so there's a good chance you can find it here. Otherwise, you'll just need to try every possible combination there is, using what you already know.
Hope this helps! :)

How do people go about attacking an encrypted file? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've been reading up on file encryption lately, and In many places I've seen warnings that encrypted files are susceptible to decryption by people so inclined regardless of encryption algorithm strength.
However, I can't get my head around how someone would go about attempting to decrypt an encrypted file.
For example, lets say you've got an encrypted file and you'd like to know it's contents. You have no idea what the key used to encrypt the file is, nor the encryption algorithm used. What do you do? (Assume for this example that the encryption algorithm is a symmetric-key algorithm such as AES-256, I.E. a file encrypted with key which requires said key to decrypt it).
Additionally, how would your approach change if you knew the encryption algorithm used? (Assume in this case that the encryption algorithm used is AES-256, with a random key + salt).
There's two ways to answer this question, in the literal sense of how a perfect crypto system is attacked, and how real world systems are attacked. One of the biggest problems you'll find as you begin to learn more about cryptography is that selecting algorithms is the easy part. It's how you manage those keys that becomes impossibly difficult.
The way in which you attack the basic primitives depends on the type of algorithm. In the case of data encrypted by symmetric ciphers like AES you use Brute force attacks. That is, you effectively try every key possible, until you find the right one. Unfortunately, barring changes in the laws of physics trying every possible 256-bit key can't be done. From Wikipedia: "A device that could check a billion billion (10^18) AES keys per second would in theory require about 3×10^51 years to exhaust the 256-bit key space"
The problem with your question about coming across a seemingly encrypted file, with no knowledge of the methods used, is that it's a bit of a hard problem known as a Distinguishing Attack. One of the requirements of all modern algorithms is that their output should be indistinguishable from random data. If I encrypt something under both AES and Twofish, and then give you some random data, absent any other information like headers, there's no way for you to tell them apart. That being said....
You asked how knowledge of the algorithm changes the approach. One assumption cryptographers usually make is that knowledge of the algorithm shouldn't affect security at all, it should all depend on the secret key. Usually whatever protocol you're working with will tell you the algorithm specifications. If this wasn't public, interoprobility would be a nightmare. Cipher Suites, for example, are sets of algorithms that protocols like SSL support. NIST FIPS and the NSA Suite B are algorithms that have been standardized by the Federal Government, that most everyone follows.
In practice though, most crypto-systems have much larger problems.
Bad random number generation: Cryptography requires very good, unpredictable random number generators. Bad random number generators can completely collapse security, as in the case of Netscape's SSL implementation. You also have examples like the Debian RNG bug, where a developer changed code to satisfy a memory leak warning, which ultimately led to Debian generating the same certificate keys for every system.
Timing Attacks: Certain operations take longer to execute on a computer than others. Sometimes, attackers can observe this latency and deduce secret values. This has been demonstrated by remotely recovering a server's private key over a local network.
Attacks against the host: One way to attack a cryptosystem is to attack the host. By cooling memory, its contents can be preserved and inspected in a machine you control.
Rubber hose cryptanalysis: Maybe one of the easiest attacks, you threaten the party with physical harm or incarceration unless they reveal the key. There has been a lot of interesting case law on whether or not courts can force you to reveal crypto keys.
AES256 is effectively unbreakable.
From http://www.wilderssecurity.com/showthread.php?t=212324:
I don't think there's any credible speculation that any agency can
break a properly implemented AES. There are no known cryptanalytic
attacks, and actually bruteforcing AES-256 is probably beyond human
capabilities within any of our lifetimes. Let's assume that 56 bit DES
can be bruteforced in 1 sec, which is a ridiculous assumption to begin
with. Then AES-256 would take 2^200 seconds, which is 5 x 10^52 years.
So, you can see that without any known weakness in AES, it would be a
total impossibility within any of our lifetimes, even with quantum
computing. Our sun will explode, approximately 5 billion years from
now, before we obtain enough computing power to bruteforce AES-256
without a known weakness. IF a weakness in AES is never found, there
is absolutely no reason to ever look for another cipher besides AES.
It will suffice for as long as humans occupy the planet.
With basic Brute force attack for example. You ask a software to try every single combination between 1 character to 15 character with a-z A-Z 0-9 and wait.
The software will start with 0 to 10... then 0a, 0b, 0c until it finds the password. Wikipedia will give you more detail.
I partially agree with Andrew and partially with Jeremy.
In the case, if encryption key is generated correctly (random generated or based on complex password, good key derivation function and random salt) then AES256 is effectively unbreakable (as Andrew said)
On other hand, if a key isn't correctly generated. As example, just straight hash of 4 digit's PIN password, brute force could be very efficient.
Regarding "You have no idea what the key used to encrypt the file is, nor the encryption algorithm used. "
In most case, encrypted files has a header or a footer which specify something (an application used to encrypt a file, encryption algorithm or something else).
You can try to figure out algorithm by padding (as example 3DES has padding and AES has different padding)

Encryption using SHA1

I am developing a large application and i need encryption when a data is traveling between two machines in different continents. I have never worked on encryption. I want a simple encryption which can be handled in PHP / Ruby / Python without any dependencies.
So i decided to use HMAC SHA1.
$pad=hash_hmac("sha1","The quick brown....","mykey");
This is what i found out after some research on the internet.
How hard it is to decrypt it if someone doesn't know the key? Also, any alternatives to this?
UPDATE - thanks for all the responses. Problem solved.
It's impossible to decrypt it, even if you know the key. HMAC SHA1 is a keyed hash algorithm, not encryption.
A hash is a cryptographic one-way function that always generates a value of the same length (I think SHA1 is 128-bits) regardless of the length of the input. The point of a hash is that, given the output value, it's computationally infeasible to find an input value to produce that output. A keyed hash is used to prevent rainbow table attacks. Even if you know the key you can't reverse the hash process.
For encryption you want to look at AES.
SHA1 is a one-way-hash function, by definition it is not decryptable by anyone. The question becomes if you have a plaintext T that hashes to H. How hard is it to find another T which also hashes to H.
According to Wikipedia, for SHA1, the best known brute force attack would take 2^51 evlautions to find a plain text that matches.
If you need actual encryption where you can reverse the process, you should take a look at AES256.
See:
http://en.wikipedia.org/wiki/Cryptographic_hash_function
For a general discussion on this.
Like Andrew said SHA1 is an hash algorithm and cannot be used for encryption (since you cannot get back the original value). The digest it produce can be used to validate the integrity of the data.
An HMAC is a construct above an hash algorithm that accept a key. However it's not for meant for encryption (again it can't be decrypted) but it allows you to sign the data, i.e. with the same key you'll be able to ensure the data was not tampered with during it's transfer.
Foe encryption you should look at using AES or, if applicable to your application, HTTPS (which will deal with more issues than you want to know about ;-)
SHA-1 , MD-5 are all one way Hashing algorithms.
They just generate a lengthy string. Each and every string when subjected to these functions will yield you a lengthy string which cannot be retained back.
They are far from encryptions.
If you are looking for encryption algorithms , go for AES (Advanced Encryption Standard) , DES (Data Encryption Standard) Algorithms.
As I say, this is a hash, so not an encryption/decryption problem. If you want to implement a straightforward encryption algorithm, I would recommend looking into XOR encryption. If the key is long enough (longer than the message) and your key sharing policy is suitably secure, this is a one time pad; otherwise, it can potentially be broken using statistical analysis.

Are Encryption and Cipher different things?

I heard some time that encryption and cipher are not the same thing, if so, what's the difference?
a cipher is a method (algorithm) used for encryption of some text. But english speakers have that habit of making verbs from nouns... hence ciphering became a synonym of encrypting.
Now, the fun part. If you consider decrypt and decipher, now they have different meanings.
decrypt means applying the decryption key to some code
decipher means finding the meaning of some text that was not deliberately encrypted.
In France (I'm french) we also have funny confusion with similar words. We have "chiffrer" (very similar to "cipher") that is the correct word and means encrypt, but we also use the verb "crypter" that means the same thing but is considered as an anglicism (verb built from english "crypted"). When we go for the opposite words "décrypter" and "dechiffrer" we also have different meanings but not like the english ones... "déchiffrer" means the same that both english words decrypt and decipher depending on the case, but "décrypter" is used when you try to get the clear text without the code (it means breaking the code). I believe there is no english word that means that.
Looking at my answer, I wonder if things were not clearer before it.... natural language is definitely some kind of encryption.
You might take a look at this article on the difference between Encryption and Cryptography. It also addresses the definition of cipher in the process.
Excerpts:
What is Cryptography?
In simple terms, cryptography is the science concerned with the study of secret communication.
What is Encryption?
...
... "encryption" basically is some process or algorithm (known as a cipher) to make information hidden or secret. And to make that process useful, you need some code (or key) to make information accessible.
A cipher is an algorithm of encryption. Ex. substitution cipher, permutation cipher, etc.
Encryption is just the process of obfuscating information.
So in a simplistic sense of the idea, you use a cipher to encrypt stuff. :)

Resources