GetImageHash

GetImageHash

Postby Horizon » Wed Oct 23, 2024 10:34 am

Hi,

I ask AI to create Hash for an image.

Code: Select all  Expand view  RUN
FUNCTION GetImageHash(cFileName)
    LOCAL nHandle, cBuffer, nHash, nByte, i

    nHandle := FOPEN(cFileName, 0)   // Dosyayı okumak için aç
    IF nHandle < 0
        ? "Dosya açılamadı"
        RETURN NIL
    ENDIF

    nHash := 0
    DO WHILE FREAD(nHandle, @cBuffer, 1) > 0
        nByte := ASC(cBuffer)
        nHash := BITOR(BITLSHIFT(nHash, 5) - nHash, nByte)
    ENDDO

    FCLOSE(nHandle)

    RETURN nHash


Change BITOR to hb_BITOR, BITLSHIFT to hb_BITSHIFT.

I could not get any result. Can you help me?

Thanks
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: GetImageHash

Postby Antonio Linares » Wed Oct 23, 2024 2:47 pm

Dear Hakan,

Please try this:

MsgInfo( nFileCRC( "yourimage.png" ) ) // any image extension
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: GetImageHash

Postby Horizon » Thu Oct 24, 2024 7:10 am

Antonio Linares wrote:Dear Hakan,

Please try this:

MsgInfo( nFileCRC( "yourimage.png" ) ) // any image extension


I will try.

Thanks.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 39 guests