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