News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Jwasm and Drizz hash

Started by ragdog, May 17, 2015, 02:48:16 AM

Previous topic - Next topic

ragdog

Hello again

I play now with Jwasm but i try compile a older source and use Drizz Cryptohash library
but i get a error with Jwasm

Quotecryptohash.inc(69) : Error A2082: Must be in segment block

; SSE4.2
IF @Version GE 900
OPTION NOKEYWORD:<CRC32>
ENDIF

CRC32 proto lpBuffer:DWORD,dwBufLen:DWORD,dwCRC:DWORD; init dwCRC = 0      ;<<<<<<<<<<<


But in Masm works why?

Regards,

rrr314159

Not sure,

in JWasm @Version is (always I think?) 800 so the option nokeyword statement wouldn't be executed. If you're using MASM ver 9 it will be executed. CRC32 may be reserved so when it hits that statement it complains not in segment block. Remove the IF @Version statement so OPTION KEYWORD is executed by JWasm, see if helps
I am NaN ;)

ragdog

I have remove this line

; SSE4.2
IF @Version GE 900
OPTION NOKEYWORD:<CRC32>
ENDIF


But without luck

Jwasm say
Quotecryptohash.inc(66) : Error A2082: Must be in segment block

ragdog

Problem solved

QuoteSSE4.2 and the new CRC32 instruction

Crc32 is a name conflict in ML v9 and Jwasm

clamicun

Good evening ragdog,
I am having the same problem.

"Crc32 is a name conflict in ML v9 and Jwasm"

Could you please be a bit more explicit.
How did you resolve the conflict ?

jj2007

Try inserting OPTION NOKEYWORD:<CRC32> in one of the first lines.

clamicun

Thanks jj,

it helped.
The error
"cryptohash.inc(69) : Error A2082: Must be in segment block"

has gone, but the case is worse now.

chtest.asm (Crypto Lib)

.686
.model flat,stdcall
option casemap:none
assume fs:nothing

include E:\masm32\include\___masm32rt.inc
;include \masm32\MasmBasic\MasmBasic.inc   
;include E:\masm32\include..\cmctools\cmc_macros.inc 
include cryptohash.inc
includelib cryptohash.lib

.data?
   align 4
   slen dd ?
   align 16
   inbuffer db 400h dup (?)
   outbuffer db 400h dup (?)

.code
ConMain proc
   invoke Readln,T('Enter string to hash: '),offset inbuffer,sizeof inbuffer
   invoke Writelnf,T('hashing "%s" length: %u',13,10),offset inbuffer,slen
   invoke CRC16,offset inbuffer,slen,INIT_CRC16
   invoke Writelnf,T('CRC16:   %.4X'),eax
   invoke CRC32,offset inbuffer,slen,INIT_CRC32
   invoke Writelnf,T('CRC32:   %.8X'),eax
   invoke Adler32,offset inbuffer,slen,INIT_ADLER32
   invoke Writelnf,T('ADLER32: %.8X'),eax
   invoke MD2Init
   invoke MD2Update,offset inbuffer,slen
   invoke MD2Final
   invoke HexEncode,eax,MD2_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('MD2:     %s'),addr outbuffer
   invoke MD4Init
   invoke MD4Update,offset inbuffer,slen
   invoke MD4Final
   invoke HexEncode,eax,MD4_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('MD4:     %s'),addr outbuffer
   invoke MD5Init
   invoke MD5Update,offset inbuffer,slen
   invoke MD5Final
   invoke HexEncode,eax,MD5_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('MD5:     %s'),addr outbuffer
   invoke RMD128Init
   invoke RMD128Update,offset inbuffer,slen
   invoke RMD128Final
   invoke HexEncode,eax,RMD128_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('RMD128:  %s'),addr outbuffer
   invoke RMD160Init
   invoke RMD160Update,offset inbuffer,slen
   invoke RMD160Final
   invoke HexEncode,eax,RMD160_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('RMD160:  %s'),addr outbuffer
   invoke RMD256Init
   invoke RMD256Update,offset inbuffer,slen
   invoke RMD256Final
   invoke HexEncode,eax,RMD256_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('RMD256:  %s'),addr outbuffer
   invoke RMD320Init
   invoke RMD320Update,offset inbuffer,slen
   invoke RMD320Final
   invoke HexEncode,eax,RMD320_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('RMD320:  %s'),addr outbuffer   
   invoke SHA1Init
   invoke SHA1Update,offset inbuffer,slen
   invoke SHA1Final
   invoke HexEncode,eax,SHA1_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('SHA1:    %s'),addr outbuffer   
   invoke SHA256Init
   invoke SHA256Update,offset inbuffer,slen
   invoke SHA256Final
   invoke HexEncode,eax,SHA256_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('SHA256:  %s'),addr outbuffer      
   invoke SHA384Init
   invoke SHA384Update,offset inbuffer,slen
   invoke SHA384Final
   invoke HexEncode,eax,SHA384_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('SHA384:  %s'),addr outbuffer      
   invoke SHA512Init
   invoke SHA512Update,offset inbuffer,slen
   invoke SHA512Final
   invoke HexEncode,eax,SHA512_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('SHA512:  %s'),addr outbuffer      
   invoke TigerInit
   invoke TigerUpdate,offset inbuffer,slen
   invoke TigerFinal
   invoke HexEncode,eax,TIGER_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('Tiger:   %s'),addr outbuffer      
   invoke WhirlpoolInit
   invoke WhirlpoolUpdate,offset inbuffer,slen
   invoke WhirlpoolFinal
   invoke HexEncode,eax,WHIRLPOOL_DIGESTSIZE,addr outbuffer
   invoke Writelnf,T('Whirlpool:  %s'),addr outbuffer      
   mov esi,128;digestsize
   .repeat
      mov edi,3;pass
      .repeat
         invoke HavalInit,esi,edi
         invoke HavalUpdate,offset inbuffer,slen
         invoke HavalFinal
         mov ecx,esi
         shr ecx,3
         invoke HexEncode,eax,ecx,addr outbuffer
         invoke Writelnf,T('Haval(%u,%u): %s'),esi,edi,addr outbuffer      
         inc edi
      .until edi > 5
      add esi,32
   .until esi > 256
   invoke Getch
   ret
ConMain endp

start:
   invoke InitConsole
   invoke ConMain
   invoke ExitProcess,eax
end start

Invoke requires prototype for procedure. !!!

Like I said. I hate nonworking examples.

jj2007

Quote from: clamicun on January 06, 2016, 11:16:03 AM
Invoke requires prototype for procedure. !!!

Like I said. I hate nonworking examples.

I agree :P

If you get that error only for a few invokes, try to see if they are in one of the .inc files in Masm32\include

This works better than Getch: invoke crt__getch
But InitConsole is nowhere defined, and Writelnf() has an inconsistent number of args.

clamicun

   ;invoke Readln
   ;invoke Writelnf,
        ;invoke Getch
   ;invoke InitConsole

cause the error, but of course without output the prog is not good for anything.

clamicun

ok.

Now it works fine and seems to return correct results.
Have to check all in an online hashcreator.
See you 

ragdog

#10
Quote"Crc32 is a name conflict in ML v9 and Jwasm"

SSE4.2 and the new CRC32 instruction  is in  ML 9.0 or newer,Jwasm reserved
And it is a Name conflict if you compile a project with this lib .
I Have recompile the lib and rename the Crc32 procedur to Crc32_  :biggrin:

clamicun