Help to integrate the ChilkatDelphiXE.dll Crypt2 functionality in Legacy Clarion6

Hallo friends.

Quick help needed to integrate the ChilkatDelphiXE.dll Crypt2 functionality in Legacy Clarion.

I wish to create a string hashing function using the SHA-256 algorithm. Anybody with sample Clarion source code? From procedure prototyping to the necessary variables to calling the procedures in the external DLL file.

Thank you in advance.

Kind regards,
Mak.

EasyDotNet has a class TSHAManaged, sample usage:

shaCrypt TSHAManaged
  hashed = shaCrypt.ComputeHash(SHAMethod::SHA256, inputData)

OpenSSL

 MODULE('libeay32.dll')
  SHA256(LONG buffer, LONG bufferlen, LONG outstr),RAW,C,NAME('SHA256')
 END

   Hash_SHA256 procedure(string str_)

    LOC:Ret              CSTRING(65)
    LOC:SHA256           CSTRING(33)

     CODE

      SHA256(address(Str_),len(clip(Str_)),address(LOC:SHA256))

      loop i# = 1 to 32
        LOC:Ret = LOC:Ret & bytetohex(val(LOC:SHA256[i#]), 1)
      end

      return LOC:Ret
2 Likes

Thank you, Mike. Incidentally .NET is still rocket science to me - am still stuck in the basic Clarion language since 1990.

However, RaFael’s response, immediately after yours, has done the magic for me.

Thank you once again for your quick response.
God bless you indeed.

Greetings form Kenya,
Mak.

Thank you so very much, RaFael.

It worked right away. In fact I’ve just tested it in C4 - my favourite Clarion version for reasons I can share later on. I had to steal ByteToHex() source from C6, though.

Now for further education, where is the documentation for the utilities in the “libeay32.dll” library to the extent of implementing them in Clarion by myself? I have for a long desired the knowledge to dig into a DLL and prototype the functions therein (such as Cryptos, Zip, SMS, FTP and eMail) in Clarion programs, but I don’t know where to begin. Kindly point me in the right direction, if you may.

I am so grateful for your response - quick and to the point. May God bless you indeed.

And greeting from Kenya,
Mak.

1 Like

https://www.openssl.org/docs/man1.0.2/man3/

1 Like

Hi,

We’ve created a Clarion wrapper template + class for the entire Chilkat library (95+ parts).
Our template is C6 -> C11, ABC and Legacy compatible.

Feel free to take a quick look at our website or send us an email to discuss further.

Regards,

Andy
www.noyantis.com