| 
	
		|  Autor | Tema: [Duda]Problema de tamaños  (Leído 3,686 veces) |  
	| 
			| 
					
						| YST 
								 
								
								 Desconectado 
								Mensajes: 965
								
								 
								I'm you
								
								
								
								
								
								     | 
 
Hola, pasando el algoritmo de RC4 a asm tengo el siguiente problema y es que al hacer un xor a un byte el otro operando ( o como se diga    ) no puede ser un dword haber si alguien me ayuda a solucionar el problema     include 'win32ax.inc'.datacBuffer db 'Hola',0cClave db 'Hola',0s db 257 dup(0)b rb 20largo dd ?.codestart:stdcall Len,cBufferdec eaxpush eaxpop [largo];   For i = 0 To 255 ; DoEvents ; s(i) = i ;   Next i mov eax,smov byte[eax],0inc eaxmov ecx,256.bucle1_:mov bl,byte[eax-1]inc blmov  byte[eax] ,blinc eaxloop .bucle1_ ;    For i = 0 To 255;        DoEvents;        j = (j + s(i) + Key(i Mod Len(sKey))) Mod 256;        tmp = s(i);        s(i) = s(j);        s(j) = tmp;    Next i;j = ebx;ja = esi;I = edixor ebx,ebxmov edi,-1.bucle2_:inc edixor esi,esimov esi,ebxmovzx eax,byte[s+edi]add esi,eaxstdcall lMod,edi,<stdcall Len,cClave>movzx eax,byte[cClave+eax]add esi,eaxstdcall lMod,esi,256mov ebx, eaxmov eax,smov cl,byte[eax+ebx] ; s(j)mov ch,byte[eax+edi] ; s(i)mov byte[eax+edi],clmov byte[eax+ebx],chcmp edi,255jne .bucle2_inc edi   ;   For l = 0 To UBound(Buffer) ;       DoEvents ;       i = (i + 1) Mod 256 ;       j = (j + s(i)) Mod 256 ;       tmp = s(i) ;       s(i) = s(j) ;       s(j) = tmp ;       Buffer(l) = Buffer(l) Xor (s((s(i) + s(j)) Mod 256)) ;   Next lxor esi,esi  ;esi = ldec esi ; esi = -1.bucle3_:inc esimov eax,ediinc eaxstdcall lMod,eax,256mov edi,eaxmov eax,ebxxor ecx,ecxmovzx ecx,byte[s+edi]add eax,ecxstdcall lMod,eax,256mov ebx,eaxmov eax,smov cl,byte[eax+ebx] ; s(j)mov ch,byte[eax+edi] ; s(i)mov byte[eax+edi],clmov byte[eax+ebx],chmov eax,cBufferadd cl,chmovzx eax,cladd eax,sstdcall lMod,eax,256mov edx,cBufferxor byte[edx+esi],eax      ; EL Problema esta aqui cmp esi,[largo]jne .bucle3_  invoke ExitProcess,0proc lMod,c1,c2push edxxor edx,edxmov eax,[c1]idiv [c2]push edxpop eaxpop edxretendp proc Len,cCadena   ;Funcion que mide la cadenapush ecx edimov ecx,-1mov edi,[cCadena]mov al,0repnz scasbmov eax,ecxnot eaxdec eaxpop edi ecxretendp.end start 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
   Yo le enseñe a Kayser a usar objetos en ASM |  |  |  | 
			| 
					
						| YST 
								 
								
								 Desconectado 
								Mensajes: 965
								
								 
								I'm you
								
								
								
								
								
								     | 
 
Ya solucione el error terminando el algoritmo de cifrado   include 'win32ax.inc'.datacBuffer db 'Hello world',0cPassword db 'Password',0  .codestart:stdcall Len,cPasswordmov ebx,eaxstdcall Len,cBufferstdcall RC4,cBuffer,cPassword,eax,ebxinvoke MessageBox,0,cBuffer,0,0invoke ExitProcess,0proc RC4,pBuffer,pPassword,pTamñoBuffer,pTamPasslocalss rb MAX_PATHendlpushaddec [pTamñoBuffer];   For i = 0 To 255 ; DoEvents ; s(i) = i ;   Next i lea eax,[s]mov byte[eax],0inc eaxmov ecx,256.bucle1_:mov bl,byte[eax-1]inc blmov  byte[eax] ,blinc eaxloop .bucle1_ ;    For i = 0 To 255;        DoEvents;        j = (j + s(i) + Key(i Mod Len(sKey))) Mod 256;        tmp = s(i);        s(i) = s(j);        s(j) = tmp;    Next i;j = ebx;ja = esi;I = edixor ebx,ebxmov edi,-1.bucle2_:inc edixor esi,esimov esi,ebxmovzx eax,byte[s+edi]add esi,eaxstdcall lMod,edi,[pTamPass]mov ecx,[pPassword]movzx eax,byte[ecx+eax]add esi,eaxstdcall lMod,esi,256mov ebx, eaxlea eax,[s]mov cl,byte[eax+ebx] ; s(j)mov ch,byte[eax+edi] ; s(i)mov byte[eax+edi],clmov byte[eax+ebx],chcmp edi,255jne .bucle2_inc edi   ;   For l = 0 To UBound(Buffer) ;       DoEvents ;       i = (i + 1) Mod 256 ;       j = (j + s(i)) Mod 256 ;       tmp = s(i) ;       s(i) = s(j) ;       s(j) = tmp ;       Buffer(l) = Buffer(l) Xor (s((s(i) + s(j)) Mod 256)) ;   Next lxor esi,esi  ;esi = ldec esi ; esi = -1.bucle3_:inc esimov eax,ediinc eaxstdcall lMod,eax,256mov edi,eaxmov eax,ebxxor ecx,ecxmovzx ecx,byte[s+edi]add eax,ecxstdcall lMod,eax,256mov ebx,eaxlea eax,[s]mov cl,byte[eax+ebx] ; s(j)mov ch,byte[eax+edi] ; s(i)mov byte[eax+edi],clmov byte[eax+ebx],chmov eax,[pBuffer]add cl,chmovzx eax,cllea edx,[s]add eax,edxmovzx eax,byte[eax]stdcall lMod,eax,256 mov edx,[pBuffer]xor byte[edx+esi],al cmp esi,[pTamñoBuffer]jne .bucle3_popadretendp proc lMod,c1,c2push edxxor edx,edxmov eax,[c1]idiv [c2]push edxpop eaxpop edxretendp proc Len,cCadenapush ecx edimov ecx,-1mov edi,[cCadena]mov al,0repnz scasbmov eax,ecxnot eaxdec eaxpop edi ecxretendp.end start
 
 |  
						| 
								|  |  
								| « Última modificación: 25 Junio 2009, 07:18 am por YST » |  En línea | 
 
   Yo le enseñe a Kayser a usar objetos en ASM |  |  |  | 
			| 
					
						| Yurix 
								
								 Desconectado 
								Mensajes: 72
								
								 
								Paz para la guerra y guerra por la paz
								
								
								
								
								
								   | 
 
Gracias , así lo hago yo !!!   Saludos y sigue así |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | tamaños swap GNU/Linux
 | linuxos | 4 | 2,875 |  24 Octubre 2011, 17:54 pm por orvtech
 |  
						|   |   | Dibujar e inicializar tablero de posibles distintos tamaños en C  [?] 
							« 1 2 3 4 5 » Programación C/C++
 | dragonlady | 45 | 15,751 |  9 Junio 2015, 00:28 am por 0xFer
 |  
						|   |   | Duda con WinForms y correcta adaptación a varios tamaños de pantalla .NET (C#, VB.NET, ASP)
 | RevolucionVegana | 4 | 4,681 |  2 Julio 2017, 09:52 am por RevolucionVegana
 |  
						|   |   | [Resuelto] Problema con resposive usando varios tamaños Desarrollo Web
 | madoko | 3 | 3,132 |  14 Agosto 2017, 17:05 pm por madoko
 |  
						|   |   | Duda - varios tamaños misma imagen en /wp-content/uploads (wordpress) Desarrollo Web
 | victorius | 3 | 2,391 |  28 Marzo 2019, 21:38 pm por victorius
 |    |