52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-11 21:02:57 | 芰閰脖 |芰憭批 撣 |摨閬 |梯璅∪
砍敺 IT_man 2014-12-11 22:31 蝺刻摩
% J" p) U7 S% s9 L9 P8 u  X; H* d& `
望潭蝬脩摮撖閬,閬銴撖瞍蝞瘜嚗甇日豢3DES撖
3DES撖(Triple DES)嚗臭撖瞍蝞瘜蝔梧3DES望蝔格芋撘嚗銝V蝝寧浩CB璅∪撖急
擐瑼X召inux臬行摰鋆mcrypt璅∠嚗寞憒銝:

( D0 g# y- g( ]' N, N; M5 V; D
  1. rpm -qa | grep php-mcrypt
銴鋆賭誨蝣

' G& c) h! p6 f1 e: c其蝬脩撱箔php瑼嚗憒phpinfo.php(批捆憒銝)亦臬行mcrypt module

/ p( n8 [4 c, y; q* u
  1. <?php7 y; ?$ s$ P) D. @6 C1 I0 B, j
  2. // Show all information, defaults to INFO_ALL0 T# d$ d( ~/ Q; m* i7 B8 E- T7 I9 c
  3. phpinfo();& R9 a% u: n% m1 p, P# R+ ^$ T( k
  4. ?>
銴鋆賭誨蝣
' U$ N2 K: m" }/ Z' P
嗅嬌rowser 瑁phpinfo.php嚗蝯憒銝:
; G; u6 u* c1 \

7 Z/ ?% P6 H4 [
, k, m0 D" v# P( T+ V
憒瘝摰鋆php-mcrypt嚗脰摰鋆(摰鋆寞)嚗摰鋆摰敺隞乩餈啣拍車寞銝隞交炎乓
銋敺撠勗臭誑啣神撖蝔撘憒銝嚗
  q9 N% B6 q& A- F3 M: \
  1. //撖賣豢啣神
    ! U! l) a) j, K1 u& U4 o
  2. function encrypt($source,$toencrypt){  1 Z$ ^3 X2 N9 s3 j+ g
  3. //撖函key   
    * o+ }6 j, U2 {) |+ L) e* h
  4. $key = $source;  
    , \2 M/ w* C* k5 J0 M8 r$ Y
  5. //雿輻3DES寞撖   ) w) C1 @7 V+ ^3 D. P3 u( S; N; m
  6. $encryptMethod = MCRYPT_TRIPLEDES;
    $ C; n, d% f5 M+ b0 k& X
  7. //憪靘憓摰冽% @1 @" s  P6 x# h  l6 n- i
  8. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  6 X8 p. ?% {; h
  9. //雿輻皂crypt_encrypt賣詨撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪5 X# {: H4 x1 Y- L" p7 ?) Y
  10. $encrypted_toencrypt = mcrypt_encrypt($encryptMethod, $key, $toencrypt, MCRYPT_MODE_ECB,$iv);   
    + J+ f+ i) L4 r1 q
  11. //唾圾撖敺摮銝
    & f% o" `+ }) Q* Q$ |7 ]1 l( O: W
  12. return base64_encode($encrypted_toencrypt);  
      }. {0 i, F- g4 V7 {% B
  13. }  
    , m' f- G: A6 `* q  I
  14. //閫撖賣豢啣神' s; `2 `# D! P
  15. function decrypt($source,$todecrypt) {  , y; G' k& d4 U) g/ j
  16. //閫撖函key嚗敹頝撖函key銝璅   
    : U- F! J9 [/ p& {/ q
  17. $key = $source;  - W& c$ \) T. p* z
  18. //閫撖閫base64蝣
    6 y: q3 z$ _# ]7 _( {
  19. $todecrypt = base64_decode($todecrypt);
    1 I8 z3 a+ g7 v' F
  20. //雿輻3DES寞閫撖
    , `" v$ H2 |% s5 w. }
  21. $encryptMethod = MCRYPT_TRIPLEDES;  
    ( E# a+ ]& J& F% s) b0 q
  22. //憪靘憓摰冽 : }5 ^! {: b1 L- r0 y8 z/ K
  23. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    ! k; c' I  A3 P% f+ ]7 `+ t- F
  24. //雿輻皂crypt_decrypt賣貉圾撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪  
    ; G4 n  q0 ]3 ^, s. f8 ?! B" l
  25. $decrypted_todecrypt = mcrypt_decrypt($encryptMethod, $key, $todecrypt, MCRYPT_MODE_ECB,$iv);
    , N0 F: K6 x/ q' r/ ~, r% _
  26. //唾圾撖敺摮銝- M  [8 e. A% b- r) Q: V  Q" U1 @7 T1 N
  27. return $decrypted_todecrypt;  
    3 |  V% H9 s' ?7 z- s( N
  28. }  
    7 s6 M. `9 u! T: S3 V
  29. //撖怠末閫撖賣訾敺嚗撠勗臭誑靘脰皜祈岫鈭  i' {3 H; _9 g6 n0 P/ a. c) v) |
  30. //key閮剖' k' M6 V# J, _$ {% V) m( h
  31. $source ="1234567890";* t6 L& H6 A) c' r! R' K3 h  u
  32. //閬撖摮銝
    . M9 t: u9 i6 ^8 w. k! J9 R# P
  33. $string ="www.av4u.co";
    ! e7 b# z: w" k
  34. echo "string=".$string."<br>";! y# o# B: @7 |. o
  35. //脰撖銝阡*蝷箏撖敺摮銝
    3 g% G/ p5 {$ q; w" ?' s( ?7 \% T
  36. $encode = encrypt($source,$string);
    6 O" ^- o! T' ^. q6 M1 M2 n
  37. echo "encode=".$encode."<br>";" w: c& e. p) w/ A* b. Y0 a
  38. //脰閫撖銝阡*蝷箄圾撖敺摮銝
    ; P  R1 h: z; i* l. N3 r
  39. $decode = decrypt($source,$encode);
    9 W) U& w* [$ m: R! k
  40. echo "decode=".$decode."<br>";
銴鋆賭誨蝣
5 ]! U7 q, m% G3 C, `* r5 y! _* C# R
蝯憒銝:

: Z% R' _( M4 `: \2 K

$ [* B; @5 }' w+ k" R' m/ G: f
瘜冽:
      憒閫撖蝔瘝雿輻灸ase64蝣潛閰梧頝函雯鞈唾撓嚗交嗥垢⊥閫霈(臬撖敺鞈唾撓航炊嚗雿臬典銝蝬脩抒閫撖舀憿)嚗蝯憒銝:

/ C$ z3 B; |4 c  p

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-12-26 04:55 , Processed in 0.085548 second(s), 19 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵