En el siguiente post publicare macros que me parecieron interesante , no soy el autor si alguien conoce al autor original avisarme y lo colocare ;) .
Aplica un NOT a cada byte haciendo una cifrado .
macro encryptNOT dstart,dsize {
local ..char,..key,..shift
repeat dsize
load ..char from dstart+%-1
..char = byte not ..char
store ..char at dstart+%-1
end repeat
}
Aplica un XOR a cada byte haciendo una cifrado .
macro crypt start,length,key {
local x,y,key_size,key_pos
virtual at 0
db key
key_size = $
end virtual
key_pos = 0
repeat length
load x from start+%-1
virtual at 0
db key
load y from key_pos
end virtual
x = x xor y
store x at start+%-1
key_pos = key_pos + 1
if key_pos >= key_size
key_pos = 0
end if
end repeat
}
Mas info : http://board.flatassembler.net/topic.php?t=8429
macro JCOND label,v1,c,v2
{
match any,c
\{
cmp v1,v2
j\#c label
\}
match ,c
\{
PARSECOND parsed@cond,v1
match cond,parsed@cond \\{ JCONDEXPR label,cond \\}
\}
}
macro .for [args]
{
common
local ..for
local ..endfor
local ..continue
__FOR equ ..for
__ENDFOR equ ..endfor
__CONTINUE equ ..continue
macro for_expr [argsa]
\{
cont = 1
if cont
match arg=+==val, argsa \\{
add arg, val
cont = 0\\}
end if
if cont
match arg=-==val, argsa \\{
sub arg, val
cont = 0\\}
end if
if cont
match arg=--, argsa \\{
dec arg
cont = 0\\}
end if
if cont
match arg=++, argsa \\{
inc arg
cont = 0\\}
end if
if cont
match arg=<<val, argsa \\{
shl arg, val
cont = 0\\}
end if
if cont
match arg=>>val, argsa \\{
shr arg, val
cont = 0\\}
end if
if cont
match arg=|==val, argsa \\{
or arg, val
cont = 0\\}
end if
if cont
match arg=&==val, argsa \\{
and arg, val
cont = 0\\}
end if
if cont
match arg=^==val, argsa \\{
xor arg, val
cont = 0\\}
end if
if cont
match arg==val, argsa \\{
mov arg, val
cont = 0\\}
end if
\}
define current args
match =(a=:b=:c=), current
\{
for_expr a
JNCOND __ENDFOR, b
\}
__FOR:
macro .break
\{
jmp __ENDFOR
\}
macro .continue
\{
jmp __CONTINUE
\}
macro .endf
\{
match =(a=:b=:c=), current
\\{
__CONTINUE:
for_expr c
JCOND __FOR, b
__ENDFOR:
restore __FOR
restore __ENDFOR
restore __CONTINUE
restore current
\\}
\}
}
En construcción
se ven interesantes, gracias YST ^^