Created
November 3, 2015 15:45
-
-
Save comtom/8c725fa9420c7892ed6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format PE | |
entry main | |
section '.text' code readable executable | |
main: | |
mov eax, [esp] | |
xor edi, edi | |
; 32 bit -> 8 nibble | |
; valor inicial de la mascara | |
xor edx, edx | |
mov edx, $0000000F | |
bucle: | |
mov ebx, eax | |
; desplaza la mascara | |
and ebx, edx | |
shl edx, 4 | |
; corre el nible a la parte baja (bl) | |
xor ecx, ecx | |
lea ecx, [4 * edi] | |
shr ebx, cl | |
; controla si es A-F o 0-9 | |
cmp ebx, 9 | |
jg aefe | |
; del 0 al 9 | |
add ebx, 48 | |
jmp continua | |
aefe: | |
sub ebx, 10 | |
add ebx, 97 | |
continua: | |
; guarda en buffer el char | |
mov byte[buffer+edi], bl | |
; increenta contador | |
add edi, 1 | |
; condicion salida | |
cmp edi, 8 | |
jne bucle | |
termina: | |
push buffer | |
push _format_output | |
call [printf] | |
add esp, 8 | |
push buffer | |
push _format_input | |
call [scanf] | |
add esp, 8 | |
ret | |
section '.data' data readable writeable | |
_format_input db "%s",0 | |
_format_output db "%s",10,0 | |
buffer dd ? | |
section '.idata' data import readable | |
include "macro\import32.inc" | |
library msvcrt, "MSVCRT.DLL" | |
import msvcrt,\ | |
printf ,'printf',\ | |
scanf ,'scanf',\ | |
exit ,'exit' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment