Hi All,
Would anyone out there be able to provide an example demonstrating the encryption/decryption of text strings between a LiveCode app and a PHP script? I have been playing around with various PHP snippets and a stack using LiveCode's encrypt command, but I just can't seem to sync things up between the two systems. I am sure a lot of folks out there could use such an example.
Thanks,
- Boo
Need an example of encryption between LiveCode and PHP
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 348
- Joined: Sun Jul 03, 2011 2:04 am
Re: Need an example of encryption between LiveCode and PHP
Hi,
dunno if it helps this much, but I had to re-code a PhP function recently:
PHP:
Livecode:
It's no encryption, only hashing, but it may give you an idea. I hope!
Have fun!
Edit: Pressed "submit" too fast ...
dunno if it helps this much, but I had to re-code a PhP function recently:
PHP:
Code: Select all
<?php
function generateHash()
{
$initKey = 'EXsl4ywgDR5mR3sTGwws9Ikl2ocSKZlvhxoFTv8Au3MaV5UqrEIJORVF5PmFNy';
$remoteDomain = 'www.server.de';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
?>
Code: Select all
on mouseUp
put "EXsl4ywgDR5mR3sTGwws9Ikl2ocSKZlvhxoFTv8Au3MaV5UqrEIJORVF5PmFNy" into MyKey
put "www.server.de" into MyServer
put "07112014" into MyDate //better a real date ...
put empty into MyHash
put 0 into mycounter
put the ticks into MyTicks
repeat for 201
get sha1digest(MyHash & MyKey & MyServer & MyDate)
put empty into MyVar
put binarydecode("H*",it,MyVar) into myOtherVar // Voodoo (stolen) :)
put MyVar into MyHash
add 1 to Mycounter
end repeat
put the Ticks into EndTicks
Put MyHash & " / " & MyCounter & " / Time: " & Endticks - Myticks into fld "output_fld"
end mouseUp
Have fun!
Edit: Pressed "submit" too fast ...
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
-
- VIP Livecode Opensource Backer
- Posts: 348
- Joined: Sun Jul 03, 2011 2:04 am
Re: Need an example of encryption between LiveCode and PHP
Hi AxWald,
Thanks for the input. Hashing can be quite useful at times... However, such a scheme does not meet the needs of my current project.
This is an awesome forum. Thanks again.
Sincerely,
- Boo
Thanks for the input. Hashing can be quite useful at times... However, such a scheme does not meet the needs of my current project.

This is an awesome forum. Thanks again.
Sincerely,
- Boo