diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-06-10 15:47:23 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-06-10 15:47:23 -0700 |
commit | 2128d5a2560383e0d3587087a7dd0aab217bc262 (patch) | |
tree | c2aa27a08a9e96ecf291d10db46e4fcf0e3806c9 /include/crypto.php | |
parent | eb6a1f838724504f0034d51a28567ea9a8119b54 (diff) | |
parent | 52ddbd1adda88690a19aafc35e455b01d059852f (diff) | |
download | volse-hubzilla-2128d5a2560383e0d3587087a7dd0aab217bc262.tar.gz volse-hubzilla-2128d5a2560383e0d3587087a7dd0aab217bc262.tar.bz2 volse-hubzilla-2128d5a2560383e0d3587087a7dd0aab217bc262.zip |
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Diffstat (limited to 'include/crypto.php')
-rw-r--r-- | include/crypto.php | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/include/crypto.php b/include/crypto.php index a4ce2cf98..494a2a5b9 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -296,34 +296,6 @@ function salmon_key($pubkey) { return 'RSA' . '.' . base64url_encode($m,true) . '.' . base64url_encode($e,true) ; } -// old function for providing mysql compatible encryption and is also -// used in Friendica 'RINO'. This function is messy and should be retired. - - -function aes_decrypt($val,$ky) -{ - $key="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - for($a=0;$a<strlen($ky);$a++) - $key[$a%16]=chr(ord($key[$a%16]) ^ ord($ky[$a])); - $mode = MCRYPT_MODE_ECB; - $enc = MCRYPT_RIJNDAEL_128; - $dec = @mcrypt_decrypt($enc, $key, $val, $mode, @mcrypt_create_iv( @mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM ) ); - return rtrim($dec,(( ord(substr($dec,strlen($dec)-1,1))>=0 and ord(substr($dec, strlen($dec)-1,1))<=16)? chr(ord( substr($dec,strlen($dec)-1,1))):null)); -} - - - -function aes_encrypt($val,$ky) -{ - $key="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - for($a=0;$a<strlen($ky);$a++) - $key[$a%16]=chr(ord($key[$a%16]) ^ ord($ky[$a])); - $mode=MCRYPT_MODE_ECB; - $enc=MCRYPT_RIJNDAEL_128; - $val=str_pad($val, (16*(floor(strlen($val) / 16)+(strlen($val) % 16==0?2:1))), chr(16-(strlen($val) % 16))); - return mcrypt_encrypt($enc, $key, $val, $mode, mcrypt_create_iv( mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM)); -} - function z_obscure($s) { return json_encode(crypto_encapsulate($s,get_config('system','pubkey'))); } |