Can someone please check my code (Yenc encrytion) Here the formula i used

The encoding process represents each octet of input data with a single corresponding encoded output character.  The ASCII value of each output character is derived by the following simple formula:

O = (I+42) % 256

That is, the output value is equal to the ASCII value of each input character plus 42, all modulo 256.  This reduces overhead by reducing the number of NULL characters (ASCII 00) that would otherwise have had needed to be escaped, since many binaries contain a disproportionately large number of NULLs).

And the code:
xor eax,eax
mov al, ;src ascii
add al,42
shr eax, 8 ;division of 256
mov ,al

Is this correct? its the phrases 'octet ' + 'modulo ' that have me asking....

thx. :)

Posted on 2006-06-27 11:11:36 by asmrixstar
modulo means taking the remainder left after division not a quotient.

movzx eax, byte ptr 
add eax, 42
xor edx, edx
mov ecx, 256
div ecx
;now edx contains the needed remainder.
Posted on 2006-06-27 12:12:33 by arafel
256 = 100h, so no div needed:

movzx eax, byte ptr 
add eax, 42
mov ,al


Ossa
Posted on 2006-06-27 12:22:30 by Ossa
It is pointless to bother with the modulus if you are dealing with byte operations as every addition has already a modulo 256 in it.
Posted on 2006-06-29 02:51:22 by roticv
so just discard ah?  :)
ie.
and eax, 0ffh
Posted on 2006-07-11 17:44:07 by asmrixstar
Your original equation is O = (I+42) % 256

If you want O to be in al and I is initally in al,

add al, 42

will give you (I+42) % 256
Posted on 2006-07-13 22:48:09 by roticv
Btw this is "encoding", not "encryption" :)
Posted on 2006-07-14 03:48:22 by f0dder