MD5 digested

a digest about MD5 availbility in uniface. Jaspers suggestion works as well in 8.4 (9.3 uenc.dll copied to the 8.4 \bin directory) Success, Uli

Posts: 5
Registered on:
Aug 6, 2008
RE: MD5 encoding
Posted: Jun 26, 2009  4:23 PM 66 views

I use MD5 enconding in UNIFACE 4GL, this is how I did it.

In the uenc.dll there is an exported function
named “MD5digest” which has the following prototype

MD5digest ((unsigned char *)pszFieldValue,
(unsigned int )ustrlen(pszFieldValue),
(unsigned char *)digest);

pszFieldValue – zero terminating string :IN
length of the string  as integer        :IN
digest – zero terminating string        :OUT

Define the following in the usys.asn

[user_3gl]
uenc.dll(MD5digest)

Create a 3gl signature, for instance named MD5external or any name which suits you. In this

signature you define the operation.

Operation name: MD5DIGEST

Parameters:
value  IN string
length IN numeric
digest INOUT string

Define in the parameter properties the “length” as int. You can define this in the interface
dropdownlist.

Further the literal name of the function is by default MD5EXTERNAL_MD5DIGEST. Go into     operation
properties and change the literal name to “MD5digest”. This is case sensitive!

Create a test form with a dummy entity.

editboxes named edt1,edt2 and a button.
Make for instance edt1 the input and edt2 the output. For this reason I made edt2, NED which
means non editable. In the detail trigger of the button I use the following proc code

variables
Numeric stringLength
String  digest
endvariables

stringLength = $length(edt1)
if (stringlength > 0)
activate “MD5EXTERNAL”.MD5DIGEST(EDT1,stringLength,digest)
endif

edt2 = digest

end

editbox edt2 contains now the md5 digest, after you put some data in edt1 and pressed the button.

Happy coding
Jasper

Posts: 4
Registered on:
Jun 26, 2008
RE: MD5 encoding
Posted: Jun 29, 2009  8:52 AM 52 views
In reply to: RE: MD5 encoding — I use MD5 enconding in UNIFACE 4GL, this is how I did it. …
posted by Jasper on Jun 26, 2009  4:23 PM

Hi Uli,

the uenc.dll is located in the bin directory of uniface. But more importatent is, that it is available from u93 not before.

Best regards.

THOMAS

Leave a Reply