source: branches/2.2.0.1/jabberir_messenger/inc/crypto.php @ 4453

Revision 4453, 1.4 KB checked in by rafaelraymundo, 13 years ago (diff)

Ticket #1726 - Adicionando jabberit_messenger da comunidade.

  • 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{
17    $cipher     = "rijndael-128";
18    $mode       = "cbc";
19    $iv                 = "@4321avaJtluafeD";
20    $td = mcrypt_module_open($cipher, "", $mode, $iv);
21    mcrypt_generic_init($td, $secret_key, $iv);
22    $cyper_text = mcrypt_generic($td, $plain_text);
23    mcrypt_generic_deinit($td);
24    mcrypt_module_close($td);
25    return bin2hex($cyper_text);
26}
27?>
Note: See TracBrowser for help on using the repository browser.