GetImageHash

Post Reply
Horizon
Posts: 1323
Joined: Fri May 23, 2008 1:33 pm

GetImageHash

Post by Horizon »

Hi,

I ask AI to create Hash for an image.

Code: Select all | Expand

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
User avatar
Antonio Linares
Site Admin
Posts: 42259
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: GetImageHash

Post by Antonio Linares »

Dear Hakan,

Please try this:

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

Antonio Linares
www.fivetechsoft.com
Horizon
Posts: 1323
Joined: Fri May 23, 2008 1:33 pm

Re: GetImageHash

Post by Horizon »

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
Post Reply