Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

asm-shift

By: a guest on Apr 29th, 2013  |  syntax: None  |  size: 0.89 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. .data
  2. taps:
  3.         .long   1
  4.         .long   2
  5.         .long   9
  6.         .long   15
  7.         .long   25
  8. .text
  9. .globl main
  10. main:
  11.         movl    0x0831423, %eax      
  12.         call    createKeystream
  13. ret
  14.  
  15. createKeystream:
  16.         movl    $32,    %edx    g
  17. lfsr:
  18.         movl    $taps,  %esi
  19.         movl    $5,     %ecx    # array size
  20.         movl    %eax,   %ebx    # seed -> temp
  21.         xorl    %edi,   %edi    # zero out index
  22.  
  23. part1:  cmpl    %edi,   %ecx    
  24.         je part2
  25.         shrl    (%esi,%edi,4),  %ebx    # temp >> taps[i]    <-------- PROBLEM
  26.         xorl    %eax,   %ebx            # seed ^ temp > temp
  27.         incl    %edi
  28.         jmp part1
  29.  
  30. part2:  andl    $1,     %ebx    # temp &= 1
  31.         shl     $31,    %ebx    # temp << 31
  32.         shr     $1,     %eax    # seed >> 1
  33.         or      %ebx,   %eax    # temp | seed -> seed
  34.         dec     %edx
  35.         jnz     lfsr
  36.  ret
clone this paste RAW Paste Data