Riddle #1

Here is a little riddle for you… no more then 30 seconds to answer :)

 mov ecx, 0Ch
 mov dl, 1h
 mov dh, 1h
 L:
  xchg dh, dl
  add dl, dh
  movzx eax, dl
  loop L

Try to figure out what the code above is intended for, and let me know…

Enjoy ;)

p.s. Are you thinking about a bug? Well, it’s not a bug.

Donato "ratsoul" Ferrante posted at 2009-12-7 Category: fun, reversing, riddle

5 Responses Leave a comment

  1. #1rastaganga @ 2009-12-8 11:23

    The pseudo code:

      a = 1
      b = 1
    
      for(i = 12; i--; i==1) {
        b = a
        a = b + a
      }
    

    I’m not sure what the code is ‘intended for’. For me it just looks like a weird loop :)

  2. #2ratsoul @ 2009-12-9 11:19

    Hi rastaganga,

    thank you for your answer. I will say more about this riddle in the following days, now may be someone else want to play with it, so I don’t want to spoil ;)

  3. #3dreyercito @ 2009-12-9 16:28

    Seems a fibonacci sequence calculator. Fibonacci(ecx) (for iterations of n>1). Am I right? Do I get a lollipop?

  4. #4ratsoul @ 2009-12-9 17:21

    Hi dreyercito,

    your answer hit the solution but it is not 100% right. You are missing something…

    So no lollipop for you dude ;)

  5. #5vsw0rd @ 2010-1-6 09:56

    2^12

Leave a Reply

(Ctrl + Enter)