3
我想將我的php代碼轉換爲python代碼。是否有可能將簡單的php代碼轉換爲python
$secret = 'segredo'; // To make the hash more difficult to reproduce.
$path = '/p/files/top_secret.pdf'; // This is the file to send to the user.
$expire = 1096891200; // At which point in time the file should expire. time() + x; would be the usual usage.
$md5 = base64_encode(md5($secret . $path . $expire, true)); // Using binary hashing.`$md5 = strtr($md5, '+/', '-_'); // + and/are considered special characters in URLs, see the wikipedia page linked in references.
$md5 = str_replace('=', '', $md5); // When used in query parameters the base64 padding character is considered special.
我想將上面的php代碼轉換爲python。是否存在一些轉換工具?
此代碼是nginx HttpSecureLinkModule的簡單唯一url生成器。
use http://www.php2python.com :) – defuz