Saturday 28 April 2018

hashing - How can SHA512 make a long string into a short string


I´m wondering how this random and very long string


€£$€@]}$€{[$£}]£[€€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]hXC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpb€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]hkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubh€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]hj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]h€£$€@]}$€{[$£}]£[€]}€486745896€$@fdhhsgpbkjhYUVYUDTYhµµµ½789ty45thhrhYUFVYU7645646f8cgI JKHVruxty dw78fg f 9w64f dfvt87t&R%EFVyubhj<G/p9\<\]}}]@}$]$€}{$€øøål5940hgsy/)T(&¤%}]€$ygrevae48g85XC&Yi45wtgsb}]

Can turn into this much shorter string


bb90e8b58596c55070ee88b25ff01627ab0c227cd11d6f876af9e81a0cd12e9d8a1ebce3af5b0fd8098ac3946a590c55ebe890066db6403cb0ee324c6edf9f3d

This dosent make any sense for me. Can two strings be the same in sha512. Etc we have string 1 and string 2 and sha512 hashed they are the same?



Answer



Very basically, a hash function (such as SHA512) takes a variable-length input (which may be shorter, longer or the same length as the output hash, and which may or may not have a maximum size dictated by how the hash function works), and through a variety of steps uses that input to alter the hash function's internal state in a predictable (deterministic) manner. At the other end, when there is no more input, the (or some portion of the) internal state of the hash function is read, possibly further processed somehow, and delivered as the output of the hash function. That output is called the "hash" of the input data.


A hash function is designed as a one-way function, also known as a trap door function; in other words, it is designed such that it is easy to compute the output given the input, but it should be infeasible to calculate the input given the output, even in cases where the input is smaller than or the same size as the output.


The output hash is of a fixed length basically because the size of the hash function's internal state (and the result of post-processing that state for output) is known. The exact output hash length is picked to be a good fit for the hash function's internals and to provide the desired level of security. Some hash functions, like MD5, RIPEMD160 or SHA-1, have a fixed-size output; others, like SHA-2 or SHA-3, can give different-length outputs depending on the specific needs of the system using the hash function.


It is possible (and even likely) that two different inputs to a hash function will produce the same output hash. For a hash with n bits of output and for two random inputs, this will happen on average after trying 2n/2 combinations, and it is guaranteed to happen by the time you have tried 2n+1 different inputs: in the worst (or best) case, each of the 2n inputs will give a unique output out of the set of 2n possible outputs, so if you try one more input then it must match one of the already computed outputs. That's called a hash collision. The aim of a cryptographic hash function such as the SHA family of hashes is not to make such collisions impossible (without expanding the hash to the full size of the input, which sort of negates the point of the hash, that is mathematically impossible), but rather to make finding such inputs extremely hard.


A hash function that allows finding collisions significantly faster than 2n/2 to 2n operations (depending on the exact method of attack; primarily, look up so-called preimage and birthday attacks if you want to learn more about that) is generally considered broken for cryptographic applications. This is why SHA-1 started its track toward deprecation in web browsers for TLS certificates in 2014 or so after a theoretically feasible attack became known in 2012, and why the old workhorse MD5 is considered horribly broken for almost any cryptographic application.


It's also important to keep in mind that the output of a hash function such as SHA512 is not the hexadecimal string that you show in your question. That is one representation of the actual hash, which is just a 64-byte (512-bit) binary value. It could just as well be stored in binary form, in Base64 encoded form, or some other representation.


No comments:

Post a Comment

Where does Skype save my contact&#39;s avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...