52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-11 21:02:57 | 芰閰脖 |芰憭批 撣 |摨閬 |梯璅∪
砍敺 IT_man 2014-12-11 22:31 蝺刻摩
0 n6 U2 u: B; C3 G$ R. L6 |) Z0 p  @  r5 z' g; t: s
望潭蝬脩摮撖閬,閬銴撖瞍蝞瘜嚗甇日豢3DES撖
3DES撖(Triple DES)嚗臭撖瞍蝞瘜蝔梧3DES望蝔格芋撘嚗銝V蝝寧浩CB璅∪撖急
擐瑼X召inux臬行摰鋆mcrypt璅∠嚗寞憒銝:
" s4 a7 g8 c1 W1 x& Y! U9 |
  1. rpm -qa | grep php-mcrypt
銴鋆賭誨蝣

) Q) U' h& X- W# Q# x& p' j9 M0 k其蝬脩撱箔php瑼嚗憒phpinfo.php(批捆憒銝)亦臬行mcrypt module

+ `9 f" C$ Y+ R9 J* E0 Q/ \
  1. <?php
    6 f* @6 Q& s, p5 L7 d0 E' v
  2. // Show all information, defaults to INFO_ALL4 @4 W" e- L0 N* w
  3. phpinfo();
    * G5 _, J1 b2 y0 M4 [- ~
  4. ?>
銴鋆賭誨蝣
  N* U% j0 \4 p5 e  @7 q3 f/ z
嗅嬌rowser 瑁phpinfo.php嚗蝯憒銝:
0 V! g# c2 [7 z3 f2 _
! ]& D3 b/ R1 J& o
5 d- q. h+ [) T7 V0 B3 w- o' b
憒瘝摰鋆php-mcrypt嚗脰摰鋆(摰鋆寞)嚗摰鋆摰敺隞乩餈啣拍車寞銝隞交炎乓
銋敺撠勗臭誑啣神撖蝔撘憒銝嚗
, P; T# {' v1 Y' Q, n
  1. //撖賣豢啣神
    0 l* B# @) [2 z# z
  2. function encrypt($source,$toencrypt){  ; e' h: ^: L+ R) q3 v( h
  3. //撖函key   # [# S6 J  l9 H& K! s# ]/ O0 y- ^5 u
  4. $key = $source;  2 y6 {4 |" F  Y$ a% V
  5. //雿輻3DES寞撖   ' }8 r5 z- R6 _7 w9 w9 e- P
  6. $encryptMethod = MCRYPT_TRIPLEDES;
      s* z. {  n: C. {
  7. //憪靘憓摰冽
    % g5 ], b0 g7 f. V+ e
  8. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  1 x0 Q7 _- M3 {% G& c1 }
  9. //雿輻皂crypt_encrypt賣詨撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪
    + j% d/ x7 @1 c6 [0 S$ C: k3 Y
  10. $encrypted_toencrypt = mcrypt_encrypt($encryptMethod, $key, $toencrypt, MCRYPT_MODE_ECB,$iv);   
      e5 Q" n$ g6 x" S
  11. //唾圾撖敺摮銝
    ; K' w6 y/ H' I, k7 W' F
  12. return base64_encode($encrypted_toencrypt);  ' x$ E/ g4 N9 v+ T3 L4 R' F
  13. }  
    1 k4 w- g1 N5 N9 j( I6 W
  14. //閫撖賣豢啣神) b6 K! v' O5 H8 K8 c& Z
  15. function decrypt($source,$todecrypt) {  ; F; F7 F: M) a/ ]) H  I7 x
  16. //閫撖函key嚗敹頝撖函key銝璅   ; t/ f& X& x; v* G* g  L' X
  17. $key = $source;  , c8 _* U4 \& A, @" S# S
  18. //閫撖閫base64蝣
    1 y0 @6 S  l% ]+ f# _% D/ ?
  19. $todecrypt = base64_decode($todecrypt);$ R9 I1 @. l; e4 c( A8 H2 c9 y
  20. //雿輻3DES寞閫撖# O! @$ _% `1 i" G5 |7 g
  21. $encryptMethod = MCRYPT_TRIPLEDES;  
    4 W! A9 ]1 c: a! l( ~
  22. //憪靘憓摰冽
    ; B6 e) b( n  m- n- [7 @! w
  23. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  9 \; G  z9 i- R2 z7 z: F1 P0 a
  24. //雿輻皂crypt_decrypt賣貉圾撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪  ' \) w* X6 c0 ~4 D/ z, u3 c% d
  25. $decrypted_todecrypt = mcrypt_decrypt($encryptMethod, $key, $todecrypt, MCRYPT_MODE_ECB,$iv);
    8 J9 i# \+ Z* r( W
  26. //唾圾撖敺摮銝
    , m, F5 |6 \- \
  27. return $decrypted_todecrypt;  ( _, U) b) N' B# J7 s
  28. }  
    $ `) _8 Y! F/ X( R7 S2 i- y
  29. //撖怠末閫撖賣訾敺嚗撠勗臭誑靘脰皜祈岫鈭6 U9 e- e1 X) M, m6 e
  30. //key閮剖( o, u* m( Z# i- G( b
  31. $source ="1234567890";
    ' f8 ~% @' Y/ ~( I3 a4 N
  32. //閬撖摮銝
    6 W0 x0 b9 K6 C/ n
  33. $string ="www.av4u.co";
    / @1 z% W+ _/ t! X% S- I
  34. echo "string=".$string."<br>";
    1 i6 b) G8 a) K( M
  35. //脰撖銝阡*蝷箏撖敺摮銝
    % u! F/ |, f, \* B
  36. $encode = encrypt($source,$string);
    # y# Q: b, _) k. ~
  37. echo "encode=".$encode."<br>";
    4 q* Y3 t1 _3 |; S2 w/ N# a
  38. //脰閫撖銝阡*蝷箄圾撖敺摮銝
    . W9 \+ B1 I) w2 ?8 P8 x
  39. $decode = decrypt($source,$encode);
    + @) w0 Q$ H, A8 J# V
  40. echo "decode=".$decode."<br>";
銴鋆賭誨蝣

5 ]/ R  {( e) k4 U5 l
蝯憒銝:
# f& }5 h; s6 N$ r( ]( ]% N; p3 B
& R' |7 {7 }* x; c# f( G5 [
瘜冽:
      憒閫撖蝔瘝雿輻灸ase64蝣潛閰梧頝函雯鞈唾撓嚗交嗥垢⊥閫霈(臬撖敺鞈唾撓航炊嚗雿臬典銝蝬脩抒閫撖舀憿)嚗蝯憒銝:
/ D5 N. N8 ~. B9 r7 E4 L

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-22 14:13 , Processed in 0.076450 second(s), 19 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵