PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → Encryption
Encryption
Started by Piet van Zanten, Dec., 16 2008 3:39 PM - 3 replies
Posted on December, 16 2008 - 3:39 PM
Hi All,
I am trying to find a compatible way to encrypt and decrypt strings (passwords) between Windev and PHP. The security is a minor issue, so simplicity prevails.
I found a nice and simple php function to crypt and decrypt that uses base_64encode:
[code]
function encode5t($str)
{
for($i=0; $i
Posted on December, 16 2008 - 6:28 PM
Hi Piet,
This works just as expected.
s is string = Crypt("This is an encoded string","",cryptNone,encodeBASE64)
Trace(s)
Trace(s="VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==") // http://ca.php.net/manual/en/function.base64-encode.php
Trace(Uncrypt(s,"",cryptNone,encodeBASE64))

Hope this helps.
Best regards.
Posted on December, 16 2008 - 7:15 PM
Thanks Alexandre,
I forgot the cryptNone. And the reverse function in Windev is different from strrev in php.
In windev:
x=edt_Edit1
FOR i=1 TO 5
y=Crypt(x,"",cryptNone,encodeBASE64)
x=""
FOR j=Length(y) TO 1 STEP -1
x+=y[[j]]
END
END

edt_Edit2=x
Regards,
Piet
Posted on December, 30 2023 - 9:14 AM
For a simple encryption/decryption between Windev and PHP using base64 encoding:

PHP Functions:
function encode5t($str) {
return base64_encode($str);
}

function decode5t($str) {
return base64_decode($str);
}

Windev Usage:

// Encryption before sending data to PHP
encodedString is string = Base64Encode("YourPasswordToEncrypt")
HTTPRequest("POST", "https://your-php-endpoint.com", encodedString)

// Decryption in PHP
<?php
$receivedData = base64_decode($_POST['your_post_variable']);
// ... rest of your PHP code
?>
Replace "YourPasswordToEncrypt" with the actual password or string. For improved security, consider stronger encryption methods, especially for passwords.

You can also check https://forum.pcsoft.fr/en-US/index.awp/