(Using NASM on Ubuntu 7.10)
I'm messing with a simple linear transposition encryption program. It added 5 to each character in the string excluding the linefeed character. I thought I would jumble it a little more by make it add 1 the the first character 2 to the second and 3 to the third, up to 6 then start at one again.
Here is what I tried.
section .data msg: db 'Message to be encrypted',0xa meglen: equ $-msg section .text global _start _resetesi: mov esi,1 ret _start: mov eax,4 ;Write origional String mov ebx,1 mov ecx,msg mov edx,meglen int 0x80 mov ebx,meglen ;Put the message in eax and the length in ebx dec ebx; mov eax,msg mov esi,1 _eachchar: add byte[eax], esi inc eax inc esi dec ebx cmp esi,6 je _resetesi cmp ebx,0 jne _eachchar mov eax,4 ;Write encrypted string mov ebx,1 mov ecx,msg mov edx,meglen int 0x80 _exit: mov eax,1 mov ebx,0 int 0x80
When I try to compile I get the error:
encrypt.asm:29: error: mismatch in operand sizes
I tried using si instead of esi, but I still got the same error. I apologize if this question could be easily google'd, but I couldn't seem to find an explanation.