Witam. Używam w swoim serwisie skryptu szyfrującego. Klon tego serwisu mam na innym hostingu i tu pojawia się problem. Skrypt na klonie musi być lekko przebudowany, bo inaczej nie szyfruje niektórych tekstów.

Cytat
SERWER 1
PHP Version 5.2.17
mcrypt support enabled
Version 2.5.8
Api No 20021217
Supported ciphers cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes cbc cfb ctr ecb ncfb nofb ofb stream

Directive Local Value Master Value
mcrypt.algorithms_dir no value no value
mcrypt.modes_dir no value no value


  1. <?php
  2. class SymmetricCrypt
  3. {
  4. private static $msSecretKey = "SECRECT KEY";
  5. private static $msHexaIv = "hdu8374hr96128b5d4b4f7b2fe7f7f05";
  6. private static $msCipherAlgorithm = MCRYPT_RIJNDAEL_256;
  7. private static $msModeAlgorithm = MCRYPT_MODE_CBC;
  8.  
  9. public static function Encrypt($plainString)
  10. {
  11. $iv = pack("H*", SymmetricCrypt::$msHexaIv);
  12. $encrypted_string = mcrypt_encrypt(
  13. SymmetricCrypt::$msCipherAlgorithm,
  14. SymmetricCrypt::$msSecretKey,
  15. $plainString,
  16. SymmetricCrypt::$msModeAlgorithm,
  17. $iv);
  18. return bin2hex($encrypted_string);
  19. }
  20.  
  21. public static function Decrypt($encryptedString)
  22. {
  23. $iv = pack("H*", SymmetricCrypt::$msHexaIv);
  24. $string = pack("H*", $encryptedString);
  25. $decrypted_string = mcrypt_decrypt(
  26. SymmetricCrypt::$msCipherAlgorithm,
  27. SymmetricCrypt::$msSecretKey,
  28. $string,
  29. SymmetricCrypt::$msModeAlgorithm,
  30. $iv);
  31. return $decrypted_string;
  32. }
  33. } //koniec klasy
  34. ?>



Cytat
SERWER 2
PHP Version 5.2.16
mcrypt support enabled
Version 2.5.8
Api No 20021217
Supported ciphers cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes cbc cfb ctr ecb ncfb nofb ofb stream

Directive Local Value Master Value
mcrypt.algorithms_dir no value no value
mcrypt.modes_dir no value no value


  1. <?php
  2. class SymmetricCrypt
  3. {
  4. private static $msSecretKey = "SECRECT KEY";
  5. private static $msHexaIv = "hdu8374hr96128b5d4b4f7b2fe7f7f05";
  6. private static $msCipherAlgorithm = MCRYPT_RIJNDAEL_256;
  7. private static $msModeAlgorithm = MCRYPT_MODE_CBC;
  8.  
  9. public static function Encrypt($plainString)
  10. {
  11. $iv = SymmetricCrypt::$msHexaIv;
  12. $encrypted_string = mcrypt_encrypt(
  13. SymmetricCrypt::$msCipherAlgorithm,
  14. SymmetricCrypt::$msSecretKey,
  15. $plainString,
  16. SymmetricCrypt::$msModeAlgorithm,
  17. $iv);
  18. return base64_encode($encrypted_string);
  19. }
  20.  
  21. public static function Decrypt($encryptedString)
  22. {
  23. $iv = SymmetricCrypt::$msHexaIv;
  24. $string = base64_decode($encryptedString);
  25. $decrypted_string = mcrypt_decrypt(
  26. SymmetricCrypt::$msCipherAlgorithm,
  27. SymmetricCrypt::$msSecretKey,
  28. $string,
  29. SymmetricCrypt::$msModeAlgorithm,
  30. $iv);
  31. return $decrypted_string;
  32. }
  33. } //koniec klasy
  34. ?>


Mógłby ktoś rzucić okiem, gdzie moze tkwic problem?