Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php androidsdk中字符串的加密_Php_Android - Fatal编程技术网

Php androidsdk中字符串的加密

Php androidsdk中字符串的加密,php,android,Php,Android,我需要加密字符串和发送到服务器是在php 下面是加密代码和加密函数 define('SALT', 'whateveryouwant'); function encrypt($text) { return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL

我需要加密字符串和发送到服务器是在php

下面是加密代码和加密函数

define('SALT', 'whateveryouwant'); 

function encrypt($text) 
{ 
        return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT,
$text, MCRYPT_MODE_ECB,
mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
MCRYPT_RAND)))); 
} 

function decrypt($text) 
{ 
        return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT,
base64_decode($text), MCRYPT_MODE_ECB,
mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
MCRYPT_RAND))); 

} 
我在android上尝试了一些课程,但根本不起作用。 有人知道android中支持此功能的函数或类吗

提前感谢

安卓已经为此准备了一个软件包

请看一个例子。同样有用的是