SHA1 Decryption!

Hello! I hope that no one will be offended by this question!! Ive been
reading the post regarding the subject sha1 hashing and there are quite
a few.
But i wonder if this is possible to figure out??
I have this coordinate and i need to figure it out. I need to get the
number for xxx and yyy. Is it possible to reverse this hash if I know
parts of the string?
("N59 52.xxx E017 42.yyy") = c884efef7c92e8095d2dd06ce8e02826dcf05a3e

···

--
Posted via http://www.ruby-forum.com/.

The whole point of hashing is that it is non-reversal. Without
brute-forcing (i.e. going through every possible permutation of
possible hash sources) it's pretty much impossible to reverse anything
hashed.

Mind, there's things like rainbow tables (for MD5, mostly), but those
"just" pre-compute the potential hashes that result from any given
input. That's why hashing makes for good checksums, and a nice way to
store passwords without really storing them (especially when a salt is
used, making rainbow tables and brute force attacks infeasible).

TL;DR: No, it's not possible to reverse a cryptographic hash.

···

On Tue, Mar 15, 2011 at 7:07 PM, Gormare Kalss <gormare@hotmail.com> wrote:

I have this coordinate and i need to figure it out. I need to get the
number for xxx and yyy. Is it possible to reverse this hash if I know
parts of the string?

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

It's probably feasible to try every combination of xxx and yyy, even in Ruby (though it'd go a lot faster in C). If those are definitely digits, there's only 1 million :slight_smile: Knowing more about the data might also help you rule out which values of xxx and yyy aren't feasible.

···

On 15/03/11 18:07, Gormare Kalss wrote:

Hello! I hope that no one will be offended by this question!! Ive been
reading the post regarding the subject sha1 hashing and there are quite
a few.
But i wonder if this is possible to figure out??
I have this coordinate and i need to figure it out. I need to get the
number for xxx and yyy. Is it possible to reverse this hash if I know
parts of the string?
("N59 52.xxx E017 42.yyy") = c884efef7c92e8095d2dd06ce8e02826dcf05a3e

--
Matthew Bloch Bytemark Hosting
                                 http://www.bytemark.co.uk/
                                   tel: +44 (0) 1904 890890

Matthew Bloch wrote in post #987597:

···

On 15/03/11 18:07, Gormare Kalss wrote:

Hello! I hope that no one will be offended by this question!! Ive been
reading the post regarding the subject sha1 hashing and there are quite
a few.
But i wonder if this is possible to figure out??
I have this coordinate and i need to figure it out. I need to get the
number for xxx and yyy. Is it possible to reverse this hash if I know
parts of the string?
("N59 52.xxx E017 42.yyy") = c884efef7c92e8095d2dd06ce8e02826dcf05a3e

It's probably feasible to try every combination of xxx and yyy, even in
Ruby (though it'd go a lot faster in C). If those are definitely
digits, there's only 1 million :slight_smile: Knowing more about the data might
also help you rule out which values of xxx and yyy aren't feasible.

One says yes and one says no :slight_smile: I havent got got a clue how to do it but
data for either xxx and yyy are between 001-999 so about a million
chances.. :slight_smile: Nice to find an example somewhere..

--
Posted via http://www.ruby-forum.com/\.

Everybody is saying the same thing. It's not possible to "decrypt" a
cryptographic hash. It *is* possible to bruteforce, but it may be very
time-consuming.

Ben

···

On Tue, Mar 15, 2011 at 11:38 AM, Gormare Kalss <gormare@hotmail.com> wrote:

One says yes and one says no :slight_smile: I havent got got a clue how to do it but
data for either xxx and yyy are between 001-999 so about a million
chances.. :slight_smile: Nice to find an example somewhere..

you can loop it for that string w x & y combi

i did a nested loop for that string alone and got

$ time ruby test_sha1_digest_loop.rb | grep
c884efef7c92e8095d2dd06ce8e02826dcf05a3e
065 988 c884efef7c92e8095d2dd06ce8e02826dcf05a3e

real 0m6.897s
user 0m11.970s
sys 0m0.170s

rechecking in irb,

require 'digest/sha1'
#=> true
Digest::SHA1.hexdigest "N59 52.065 E017 42.988"
#=> "c884efef7c92e8095d2dd06ce8e02826dcf05a3e"

best regards -botp

···

On Wed, Mar 16, 2011 at 2:38 AM, Gormare Kalss <gormare@hotmail.com> wrote:

One says yes and one says no :slight_smile: I havent got got a clue how to do it but
data for either xxx and yyy are between 001-999 so about a million
chances.. :slight_smile: Nice to find an example somewhere..

Ben Bleything wrote in post #987607:

Everybody is saying the same thing. It's not possible to "decrypt" a
cryptographic hash. It *is* possible to bruteforce, but it may be very
time-consuming.

Not very in this case.

brian@zino:~$ cat dehash.rb
require 'digest/sha1'
TARGET = "c884efef7c92e8095d2dd06ce8e02826dcf05a3e"
1000.times do |i|
  1000.times do |j|
    if Digest::SHA1.hexdigest("N59 52.%03d E017 42.%03d" % [i,j]) ==
TARGET
      raise "Whoo! #{i} #{j}"
    end
  end
end
brian@zino:~$ time ruby dehash.rb
dehash.rb:6: Whoo! 65 988 (RuntimeError)
  from dehash.rb:4:in `times'
  from dehash.rb:4
  from dehash.rb:3:in `times'
  from dehash.rb:3

real 0m0.839s
user 0m0.820s
sys 0m0.010s

···

--
Posted via http://www.ruby-forum.com/\.

...

dehash.rb:6: Whoo! 65 988 (RuntimeError)

...

Now if only it had been a location more interesting than a road in
Sweden. (Of course to the original poster it is obviously of
interest.)

Aaron out.

···

On Tue, Mar 15, 2011 at 1:38 PM, Brian Candler <b.candler@pobox.com> wrote:

Brian Candler wrote in post #987608:

1000.times do |i|
  1000.times do |j|
    if Digest::SHA1.hexdigest("N59 52.%03d E017 42.%03d" % [i,j]) == TARGET
      raise "Whoo! #{i} #{j}"

You can't do this: there might be another location with the same hash.
You have to prove (mathematically) that no two locations can have the
same SHA1 hash.

···

--
Posted via http://www.ruby-forum.com/\.

Amend that: A wood or small forest in Sweden. (I repeatedly forget
that Google Maps tries to find the nearest point on a road when
coordinates are searched for.)

Aaron out.

···

On Tue, Mar 15, 2011 at 6:31 PM, Aaron D. Gifford <astounding@gmail.com> wrote:

Now if only it had been a location more interesting than a road in
Sweden. (Of course to the original poster it is obviously of
interest.)

You can't do this: there might be another location with the same hash.
You have to prove (mathematically) that no two locations can have the
same SHA1 hash.

The probability of this occurring is vanishingly small: the number of
possibilities is much less than the keyspace. Avoiding collisions is a
hallmark of robust hashing.

~ jf

···

--
John Feminella
Principal Consultant, BitsBuilder
LI: http://www.linkedin.com/in/johnxf
SO: User John Feminella - Stack Overflow

On Wed, Mar 16, 2011 at 00:43, Albert Schlef <albertschlef@gmail.com> wrote:

Brian Candler wrote in post #987608:

1000.times do |i|
1000.times do |j|
if Digest::SHA1.hexdigest("N59 52.%03d E017 42.%03d" % [i,j]) == TARGET
raise "Whoo! #{i} #{j}"

You can't do this: there might be another location with the same hash.
You have to prove (mathematically) that no two locations can have the
same SHA1 hash.

--
Posted via http://www.ruby-forum.com/\.

Or the location of a safehouse from a stalker... of course, unlikely, but
since nobody bothered to ask, it's probably not that important... :slight_smile:

-Nick Klauer

···

On Tue, Mar 15, 2011 at 19:34, Aaron D. Gifford <astounding@gmail.com>wrote:

On Tue, Mar 15, 2011 at 6:31 PM, Aaron D. Gifford <astounding@gmail.com> > wrote:
> Now if only it had been a location more interesting than a road in
> Sweden. (Of course to the original poster it is obviously of
> interest.)

Amend that: A wood or small forest in Sweden. (I repeatedly forget
that Google Maps tries to find the nearest point on a road when
coordinates are searched for.)

Aaron out.

Google Maps