52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-11 21:02:57 | 芰閰脖 |芰憭批 撣 |甇摨閬 |梯璅∪
砍敺 IT_man 2014-12-11 22:31 蝺刻摩 ) O" e0 P6 O5 k5 o  A# l. r! f& Z

% \/ j8 B1 r$ i, A" _
望潭蝬脩摮撖閬,閬銴撖瞍蝞瘜嚗甇日豢3DES撖
3DES撖(Triple DES)嚗臭撖瞍蝞瘜蝔梧3DES望蝔格芋撘嚗銝V蝝寧浩CB璅∪撖急
擐瑼X召inux臬行摰鋆mcrypt璅∠嚗寞憒銝:

6 f7 |0 X6 y* f) C0 O; d
  1. rpm -qa | grep php-mcrypt
銴鋆賭誨蝣

1 m  |' R' c- A. X$ e( w7 r其蝬脩撱箔php瑼嚗憒phpinfo.php(批捆憒銝)亦臬行mcrypt module
- t* J& B, f. b4 ?
  1. <?php' v5 I" [. \4 ]
  2. // Show all information, defaults to INFO_ALL  w0 A4 V" K3 {. G% R# J  e2 S
  3. phpinfo();
    / ?& |1 K* v* P0 |5 a
  4. ?>
銴鋆賭誨蝣
, k! c- u* m' q8 m7 V
嗅嬌rowser 瑁phpinfo.php嚗蝯憒銝:
6 D' [" D! S% p* T4 N. `4 P. n
% `  u4 m  N  U

* M7 m% t( d" ]  i' s
憒瘝摰鋆php-mcrypt嚗脰摰鋆(摰鋆寞)嚗摰鋆摰敺隞乩餈啣拍車寞銝隞交炎乓
銋敺撠勗臭誑啣神撖蝔撘憒銝嚗

& G3 D- T0 Q! s- H" a
  1. //撖賣豢啣神! m/ h" v' b& R5 W
  2. function encrypt($source,$toencrypt){  ! o+ b5 w$ D- ?3 q+ M8 I
  3. //撖函key   
    - {& j- U7 O7 {" v" E; P
  4. $key = $source;  # j0 d; O( M! `! ~+ n( A
  5. //雿輻3DES寞撖   7 h* Q4 o  f  h7 j
  6. $encryptMethod = MCRYPT_TRIPLEDES; / E, m% O0 i! F6 l: L7 T3 R. d
  7. //憪靘憓摰冽$ ~( W& r: `( o# F; y$ S
  8. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    7 I, W4 w0 Y9 t" d1 D/ f+ j" ?& }
  9. //雿輻皂crypt_encrypt賣詨撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪7 G  ?7 \6 }9 O5 j3 h& c
  10. $encrypted_toencrypt = mcrypt_encrypt($encryptMethod, $key, $toencrypt, MCRYPT_MODE_ECB,$iv);   4 I, h( P& u! M1 `% p
  11. //唾圾撖敺摮銝
    6 g/ w: L+ N2 r
  12. return base64_encode($encrypted_toencrypt);  
    2 X, W: r) S! l7 ^! C
  13. }  ! j8 X  l1 x5 L4 T+ x% d
  14. //閫撖賣豢啣神, p0 I" {- o* s+ e9 ?
  15. function decrypt($source,$todecrypt) {  
    ( E. n# \, P# N) o5 C9 \+ J* |" m
  16. //閫撖函key嚗敹頝撖函key銝璅   " w: C$ m6 I/ L7 ~( c6 }" ]
  17. $key = $source;  $ W! f; p9 i( v. `! W
  18. //閫撖閫base64蝣. `- Y: M% [& }
  19. $todecrypt = base64_decode($todecrypt);" [+ g9 c2 }7 ]$ Y
  20. //雿輻3DES寞閫撖7 L; X. \! i. F# d  }$ ~# e1 N
  21. $encryptMethod = MCRYPT_TRIPLEDES;  
    * g! e( s0 z% L2 ]# O, B# {
  22. //憪靘憓摰冽 ! f+ L% z: P& p+ H+ s4 Y7 r
  23. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  " K: {& ~7 y3 w+ B
  24. //雿輻皂crypt_decrypt賣貉圾撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪  3 K4 c6 K% z+ C. |
  25. $decrypted_todecrypt = mcrypt_decrypt($encryptMethod, $key, $todecrypt, MCRYPT_MODE_ECB,$iv);
    ' U  g$ w1 G7 P
  26. //唾圾撖敺摮銝0 s' p0 _2 Z% y" o% `+ J
  27. return $decrypted_todecrypt;  8 C, r5 n) Z& f, S/ v# |
  28. }  
    ; S3 k, M- R. q3 f+ A( U1 h; k
  29. //撖怠末閫撖賣訾敺嚗撠勗臭誑靘脰皜祈岫鈭$ ^; S7 [2 ?9 y7 ~0 A8 L2 u
  30. //key閮剖
    2 `+ ~6 m2 W# h4 ^4 _. c  u6 J
  31. $source ="1234567890";
    ; U/ A' |' n$ w& |7 ^& n
  32. //閬撖摮銝
    , c' M+ R3 ?- ^  Q3 F9 _9 m8 q
  33. $string ="www.av4u.co";
    % P, q* \+ S7 u
  34. echo "string=".$string."<br>";
    / l* N  x2 N, N: X
  35. //脰撖銝阡*蝷箏撖敺摮銝+ R" ~) `3 u9 X2 P* \
  36. $encode = encrypt($source,$string);- V& G: L& a& G( i( D3 Y& Q
  37. echo "encode=".$encode."<br>";
    9 V+ o9 s" ?1 Y9 ?" e
  38. //脰閫撖銝阡*蝷箄圾撖敺摮銝1 M' q  p+ ]) O3 E
  39. $decode = decrypt($source,$encode);) e2 E+ o: S6 G& ?+ p
  40. echo "decode=".$decode."<br>";
銴鋆賭誨蝣
- V. K! R; e- h: }4 b# `  q
蝯憒銝:
; o# ~4 R9 S& k+ H2 O0 n1 R
4 n4 \. k" {3 I' Q8 R8 m
瘜冽:
      憒閫撖蝔瘝雿輻灸ase64蝣潛閰梧頝函雯鞈唾撓嚗交嗥垢⊥閫霈(臬撖敺鞈唾撓航炊嚗雿臬典銝蝬脩抒閫撖舀憿)嚗蝯憒銝:
2 a. \' {: i$ E7 w" t" \9 K7 @, @

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-22 14:51 , Processed in 0.063278 second(s), 20 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵