source: branches/2.2/jabberit_messenger/inc/crypto.php @ 3102

Revision 3102, 1.4 KB checked in by amuller, 14 years ago (diff)

Ticket #986 - Efetuado merge para o Branch 2.2( atualizacao do modulo)

  • Property svn:executable set to *
Line 
1<?php
2/***************************************************************************\
3*  Expresso - Expresso Messenger                                            *
4*      - Serge Rehem                                                        *
5*      - JETI - http://jeti-im.org/                                         *
6* ------------------------------------------------------------------------- *
7*  This code is based on AES Interop Between PHP and Java (Part 1) post at  *
8*  http://propaso.com/blog/?cat=6                                           *
9* ------------------------------------------------------------------------- *
10*  This program is free software; you can redistribute it and/or modify it  *
11*  under the terms of the GNU General Public License as published by the    *
12*  Free Software Foundation; either version 2 of the License, or (at your   *
13*  option) any later version.                                               *
14\***************************************************************************/               
15function encrypt($plain_text , $secret_key) {
16    $cipher     = "rijndael-128";
17    $mode       = "cbc";
18    $iv                 = "@4321avaJtluafeD";
19    $td = mcrypt_module_open($cipher, "", $mode, $iv);
20    mcrypt_generic_init($td, $secret_key, $iv);
21    $cyper_text = mcrypt_generic($td, $plain_text);
22    mcrypt_generic_deinit($td);
23    mcrypt_module_close($td);
24    return bin2hex($cyper_text);
25}
26?>
Note: See TracBrowser for help on using the repository browser.