52AV璈A|52AV.ONE

 曉撖蝣
 蝡唾酉
敹急瑕
  • av隢憯BBS
  • 璈A
  • 芣瑟憭瘚
  • 鞎澆
  • 52av鋆貉摰
  • 銝剜-銝剖銝餅
     
亦: 4199|敺: 0
銝銝銝駁 銝銝銝駁

[蝬脤隡箸沘 Linux銝隞仙HP啣神 3DES(mcrypt) 撖寞(ECB璅∪)[3撘萄]

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-11 21:02:57 | 芰閰脖 |芰憭批 撣 |摨閬 |梯璅∪
砍敺 IT_man 2014-12-11 22:31 蝺刻摩 , N7 U; S# P, G  r7 p2 G
8 x5 f; g# E' l$ G' w8 L
望潭蝬脩摮撖閬,閬銴撖瞍蝞瘜嚗甇日豢3DES撖
3DES撖(Triple DES)嚗臭撖瞍蝞瘜蝔梧3DES望蝔格芋撘嚗銝V蝝寧浩CB璅∪撖急
擐瑼X召inux臬行摰鋆mcrypt璅∠嚗寞憒銝:
6 |( M; |. C* P" o  D9 }
  1. rpm -qa | grep php-mcrypt
銴鋆賭誨蝣
4 G5 K/ m( N& Z* i. |% \7 u% K2 |6 h
其蝬脩撱箔php瑼嚗憒phpinfo.php(批捆憒銝)亦臬行mcrypt module

- @* U8 E, b5 D+ @8 B
  1. <?php5 T8 }0 O  O: i
  2. // Show all information, defaults to INFO_ALL
    0 W, ^* j3 r  e- a& H1 s; m) M% N9 d$ d
  3. phpinfo();
    & n# H% o9 S$ ~" x. v( a0 W" p, F
  4. ?>
銴鋆賭誨蝣

9 L. _& m  r$ Q' f3 |嗅嬌rowser 瑁phpinfo.php嚗蝯憒銝:
( f1 A* w) R% L, g
& n6 j% x- ^, K- U' U3 g! `3 M

: L, S/ }' k1 D$ |5 X
憒瘝摰鋆php-mcrypt嚗脰摰鋆(摰鋆寞)嚗摰鋆摰敺隞乩餈啣拍車寞銝隞交炎乓
銋敺撠勗臭誑啣神撖蝔撘憒銝嚗
: f7 X# p( ]3 k0 e; \* ]# @% B6 a
  1. //撖賣豢啣神
    , K" ?! V3 B. D  W" |" F
  2. function encrypt($source,$toencrypt){  , A) a8 L' }+ C- K% Z: D
  3. //撖函key   8 H# X  m2 d8 e4 g0 f& O0 T
  4. $key = $source;  
    $ B* f0 `7 P0 y. ?. o/ P' S5 g
  5. //雿輻3DES寞撖   * v0 M" _4 F6 Q) P
  6. $encryptMethod = MCRYPT_TRIPLEDES; 3 a9 w" i4 r/ \+ a7 P0 H0 N
  7. //憪靘憓摰冽
    6 K- f' e% ^: u6 V
  8. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    # s+ f1 f) `7 a* w# k) f* G
  9. //雿輻皂crypt_encrypt賣詨撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪2 I) _! X% Z2 \( o* s$ ~* |' d
  10. $encrypted_toencrypt = mcrypt_encrypt($encryptMethod, $key, $toencrypt, MCRYPT_MODE_ECB,$iv);   - k8 ^# G% r" N
  11. //唾圾撖敺摮銝
    . _7 Z' F& \' k& ]
  12. return base64_encode($encrypted_toencrypt);  
      h' _( U! k2 ]1 N: P0 D
  13. }  , G4 v: S- |7 `& U  W# H* @8 b
  14. //閫撖賣豢啣神8 i7 b! e0 P8 x3 k/ W, A; C
  15. function decrypt($source,$todecrypt) {  
    / ~2 R2 j# C0 _/ y9 Q
  16. //閫撖函key嚗敹頝撖函key銝璅   
    ) j# B5 u* T' M8 ~! g( |
  17. $key = $source;  8 i& R  ]0 V0 g1 B1 M, d
  18. //閫撖閫base64蝣
    + p4 u- [" t! |: x. i3 T7 k
  19. $todecrypt = base64_decode($todecrypt);* j3 w5 v, @1 f: q
  20. //雿輻3DES寞閫撖+ Q1 L* z, R/ O+ L+ f
  21. $encryptMethod = MCRYPT_TRIPLEDES;  
    , v; a  D0 p6 d3 g# X+ a. [
  22. //憪靘憓摰冽
    ; w; [  o; l6 O
  23. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    5 F& Q- }/ m) U
  24. //雿輻皂crypt_decrypt賣貉圾撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪  
    , X5 f/ T2 H2 _5 u( s- D/ d
  25. $decrypted_todecrypt = mcrypt_decrypt($encryptMethod, $key, $todecrypt, MCRYPT_MODE_ECB,$iv);" H, L* N* A; m, j
  26. //唾圾撖敺摮銝6 A6 S% J; u; H
  27. return $decrypted_todecrypt;  
    6 A/ x9 k$ V1 {. u  F8 v
  28. }  
    . ?# x* c7 \; M. ]
  29. //撖怠末閫撖賣訾敺嚗撠勗臭誑靘脰皜祈岫鈭
    * O9 d/ s5 ^8 C  Q) y  \/ v
  30. //key閮剖$ H0 e. Y2 ^0 ]* H. q: o
  31. $source ="1234567890";
    8 d" b1 J" y7 |* E
  32. //閬撖摮銝
    7 v4 t- r! q/ W) Q$ w# c
  33. $string ="www.av4u.co";
    4 Q0 h) k" e! c% l& j  h6 n5 s; U
  34. echo "string=".$string."<br>";
    : j2 Y+ t/ j! u3 S7 m" v
  35. //脰撖銝阡*蝷箏撖敺摮銝+ d8 N& N8 g: Q# F8 t
  36. $encode = encrypt($source,$string);
    & u& m6 [, M5 J; T0 z( h% A" t( b. E' Q
  37. echo "encode=".$encode."<br>";; T) _# a! R  D0 y7 W
  38. //脰閫撖銝阡*蝷箄圾撖敺摮銝
    " w. n' p4 P' u. [/ O5 E& l
  39. $decode = decrypt($source,$encode);/ w# `4 X, v( i
  40. echo "decode=".$decode."<br>";
銴鋆賭誨蝣

1 K' m% m$ E/ y
蝯憒銝:

- W: I4 t, R/ ?+ j4 L2 e

" p% N7 G/ }+ Q
瘜冽:
      憒閫撖蝔瘝雿輻灸ase64蝣潛閰梧頝函雯鞈唾撓嚗交嗥垢⊥閫霈(臬撖敺鞈唾撓航炊嚗雿臬典銝蝬脩抒閫撖舀憿)嚗蝯憒銝:
8 g4 r0 X+ e' z

雿輻券

祉蝛閬

BT蝳

砍憛批捆靘餉衣雯頝臬批捆蝝颲行粹嗥蝬脩嚗摰撟湔遛嚗嚗甇脖誑銝嗅啣摰嗆摰撟湧翩鈭箏ㄚ孵舫脣伐銝憿亙祉璇甈橘芣遛18甇 雓蝯脣亦閬賬粹脩芣遛18甇脖芣撟渡雯閬賜雯頝臭嗥批捆鞈閮嚗撱箄降典舫脰蝬脰楝批捆蝝蝯蝜ICRA蝝摰鋆閮剖 (粹蝯行霅 祉蝬脣銝蝝瘛函隢憯啣嚗祉閮剜蝞∠)

QQ|撠暺撅||52AV璈A

GMT+8, 2024-12-26 17:27 , Processed in 0.065178 second(s), 19 queries .

蝯∠.撱

[email protected] | QQ:2405733034     since 2015-01

鋆貉憒 敹恍敺 餈銵