52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-11 21:02:57 | 芰閰脖 |芰憭批 撣 |摨閬 |梯璅∪
砍敺 IT_man 2014-12-11 22:31 蝺刻摩
9 }- T8 q5 r' k( i/ ], m! @! Z, f+ K( g9 e6 G& M
望潭蝬脩摮撖閬,閬銴撖瞍蝞瘜嚗甇日豢3DES撖
3DES撖(Triple DES)嚗臭撖瞍蝞瘜蝔梧3DES望蝔格芋撘嚗銝V蝝寧浩CB璅∪撖急
擐瑼X召inux臬行摰鋆mcrypt璅∠嚗寞憒銝:

9 u1 K) N7 s7 I/ ^9 _. E
  1. rpm -qa | grep php-mcrypt
銴鋆賭誨蝣

$ x2 I1 g$ K2 F' J其蝬脩撱箔php瑼嚗憒phpinfo.php(批捆憒銝)亦臬行mcrypt module

+ C8 I: h4 U& ^: f) q, R
  1. <?php/ |5 Z! J& {5 q% f+ G0 `
  2. // Show all information, defaults to INFO_ALL
    * P. ^+ w$ T) D
  3. phpinfo();
    . I9 D3 C8 Z( _9 }
  4. ?>
銴鋆賭誨蝣
9 H. u( p7 o+ A2 o2 B2 h
嗅嬌rowser 瑁phpinfo.php嚗蝯憒銝:

8 M- ]3 x3 a. R9 I+ \0 o

+ K* g. d* m$ d4 e4 ~

' c! l0 U! x$ \5 l  ?
憒瘝摰鋆php-mcrypt嚗脰摰鋆(摰鋆寞)嚗摰鋆摰敺隞乩餈啣拍車寞銝隞交炎乓
銋敺撠勗臭誑啣神撖蝔撘憒銝嚗
3 v+ v( s+ o( |. V, M
  1. //撖賣豢啣神
    + Z. ]- _, f: L: w+ j  F! b
  2. function encrypt($source,$toencrypt){  
    ' Q6 j$ Z( E' |* f7 ^
  3. //撖函key   
    8 f$ X! P  X5 L1 Z; q# [* j* p. c
  4. $key = $source;  ! u4 n# r* N1 d: u
  5. //雿輻3DES寞撖   
    ' A) X. D: i3 {: _
  6. $encryptMethod = MCRYPT_TRIPLEDES;
    0 P7 m7 D$ E5 f/ ~' x
  7. //憪靘憓摰冽! h1 ?+ |# V- L+ d2 _' o/ L
  8. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  1 ^6 B1 ?7 k# U" Y* t% C# u  o
  9. //雿輻皂crypt_encrypt賣詨撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪
    & B* k: V! F* I
  10. $encrypted_toencrypt = mcrypt_encrypt($encryptMethod, $key, $toencrypt, MCRYPT_MODE_ECB,$iv);   * n9 N1 m( H& ]4 W9 P& F
  11. //唾圾撖敺摮銝& f+ n2 E& K% P) ^8 d2 u% F, Z3 ?: _
  12. return base64_encode($encrypted_toencrypt);  " T" k8 A; A8 B& Q6 w
  13. }  9 j' f+ _, f# x6 T" `
  14. //閫撖賣豢啣神$ P) M% Q0 P' N1 q  u3 @
  15. function decrypt($source,$todecrypt) {  : Y# h6 i+ I3 A  S+ x8 q* ]* i7 g
  16. //閫撖函key嚗敹頝撖函key銝璅   
    1 x. {5 j& U/ b' E/ @& f5 `
  17. $key = $source;  
    2 x9 y* [* h1 j4 W# I4 @& u, {
  18. //閫撖閫base64蝣
    4 @! e, ~3 W- `8 g& V$ z; q$ a9 f
  19. $todecrypt = base64_decode($todecrypt);
      k: p" ~8 K3 L
  20. //雿輻3DES寞閫撖
    2 z* `; g$ B8 i" _) H7 i
  21. $encryptMethod = MCRYPT_TRIPLEDES;  
    . v8 e. l7 G. V
  22. //憪靘憓摰冽
    & B' ?3 N" [: ]% ]6 J
  23. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  ' [% k6 n, ~4 i1 Q9 c- v
  24. //雿輻皂crypt_decrypt賣貉圾撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪  
    % J+ T/ g- \: \4 L( A5 ]5 h
  25. $decrypted_todecrypt = mcrypt_decrypt($encryptMethod, $key, $todecrypt, MCRYPT_MODE_ECB,$iv);  y4 C6 G0 p( i. z9 L* D" k) N
  26. //唾圾撖敺摮銝
    * d& k4 _% \1 S$ |
  27. return $decrypted_todecrypt;  9 X& W5 X3 a+ [& ]! f; f
  28. }  
    $ j& t7 j( n7 u! G- k0 j0 k
  29. //撖怠末閫撖賣訾敺嚗撠勗臭誑靘脰皜祈岫鈭- R, a- ?" m" Z
  30. //key閮剖
    # \$ W* Y. v* B1 ?! G2 m
  31. $source ="1234567890";6 l" w% _# F. G5 ]. N. a& n
  32. //閬撖摮銝7 v; U( k! z2 W$ h! i" m
  33. $string ="www.av4u.co";
    : g4 s' ~$ r& r7 z
  34. echo "string=".$string."<br>";
    - S6 S: o1 |6 ~
  35. //脰撖銝阡*蝷箏撖敺摮銝3 i& D/ {' i. H
  36. $encode = encrypt($source,$string);% i+ k/ a  a1 |+ R9 z; Q* a
  37. echo "encode=".$encode."<br>";
    - d  `6 S" g9 i6 H6 d0 }( N6 h/ b
  38. //脰閫撖銝阡*蝷箄圾撖敺摮銝
    ( `/ N* O  J5 V( r
  39. $decode = decrypt($source,$encode);
    + Y0 g, ]. H. e6 k
  40. echo "decode=".$decode."<br>";
銴鋆賭誨蝣
! _6 K3 i6 q+ z# Y8 g
蝯憒銝:
  q# R% X: L5 {: U
! G  M; ]- v3 T9 N9 q* F9 e
瘜冽:
      憒閫撖蝔瘝雿輻灸ase64蝣潛閰梧頝函雯鞈唾撓嚗交嗥垢⊥閫霈(臬撖敺鞈唾撓航炊嚗雿臬典銝蝬脩抒閫撖舀憿)嚗蝯憒銝:

/ C) q2 O  Y/ E; x2 F* T. U+ w2 r

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-22 08:18 , Processed in 0.074625 second(s), 19 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵