SHA1 Decryption!!

Discussion in 'Ruby' started by Gormare Kalss, Mar 15, 2011.

  1. 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/.
    Gormare Kalss, Mar 15, 2011
    #1
    1. Advertising

  2. 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 :) 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 :) 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.. :) Nice to find an example somewhere..

    --
    Posted via http://www.ruby-forum.com/.
    Gormare Kalss, Mar 15, 2011
    #2
    1. Advertising

  3. 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/.
    Brian Candler, Mar 15, 2011
    #3
  4. Aaron D. Gifford, Mar 16, 2011
    #4
  5. On Tue, Mar 15, 2011 at 6:31 PM, Aaron D. Gifford <> wr=
    ote:
    > Now if only it had been a location more interesting than a road in
    > Sweden. =A0(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.


    http://maps.google.com/maps?f=3Dq&source=3Ds_q&hl=3Den&geocode=3D&q=3DN59 5=
    2.065+E017+42.988&aq=3D&sll=3D37.0625,-95.677068&sspn=3D42.631141,84.814453=
    &ie=3DUTF8&ll=3D59.867785,17.716613&spn=3D0.000828,0.002588&t=3Dh&z=3D19&iw=
    loc=3Dnear
    Aaron D. Gifford, Mar 16, 2011
    #5
  6. Gormare Kalss

    Nick Klauer Guest

    [Note: parts of this message were removed to make it a legal post.]

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


    -Nick Klauer


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

    > On Tue, Mar 15, 2011 at 6:31 PM, Aaron D. Gifford <>
    > 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.
    >
    >
    >
    > http://maps.google.com/maps?f=q&sou...613&spn=0.000828,0.002588&t=h&z=19&iwloc=near
    >
    >
    Nick Klauer, Mar 16, 2011
    #6
  7. Gormare Kalss

    botp Guest

    On Wed, Mar 16, 2011 at 2:38 AM, Gormare Kalss <> wrote:
    > One says yes and one says no :) 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.. :) 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
    botp, Mar 16, 2011
    #7
  8. 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/.
    Albert Schlef, Mar 16, 2011
    #8
  9. > 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: http://stackoverflow.com/users/75170/



    On Wed, Mar 16, 2011 at 00:43, Albert Schlef <> wrote=
    :
    > Brian Candler wrote in post #987608:
    >> 1000.times do |i|
    >> =C2=A0 1000.times do |j|
    >> =C2=A0 =C2=A0 if Digest::SHA1.hexdigest("N59 52.%03d E017 42.%03d" % [i,=

    j]) =3D=3D TARGET
    >> =C2=A0 =C2=A0 =C2=A0 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/.
    >
    >
    John Feminella, Mar 16, 2011
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dil via .NET 247

    SHA1 length of resulting hash

    Dil via .NET 247, Aug 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    17,912
    Dil via .NET 247
    Aug 4, 2004
  2. Al Murphy

    SHA1 hash generator in hex

    Al Murphy, Mar 2, 2004, in forum: Java
    Replies:
    5
    Views:
    27,887
    darkzak
    Jan 7, 2009
  3. Rafal 'Raf256' Maj

    md5/sha1

    Rafal 'Raf256' Maj, Jul 5, 2003, in forum: C Programming
    Replies:
    2
    Views:
    526
    Shill
    Jul 5, 2003
  4. LMZ
    Replies:
    5
    Views:
    509
    Martin v. Löwis
    Apr 6, 2008
  5. Adam Tauno Williams
    Replies:
    2
    Views:
    849
    Stefan Behnel
    Dec 30, 2010
Loading...

Share This Page