52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-11 21:02:57 | 芰閰脖 |芰憭批 撣 |摨閬 |梯璅∪
砍敺 IT_man 2014-12-11 22:31 蝺刻摩 - z/ a9 \. w. I% n* Y* q

1 l( Y. x7 [5 e( l7 q* t
望潭蝬脩摮撖閬,閬銴撖瞍蝞瘜嚗甇日豢3DES撖
3DES撖(Triple DES)嚗臭撖瞍蝞瘜蝔梧3DES望蝔格芋撘嚗銝V蝝寧浩CB璅∪撖急
擐瑼X召inux臬行摰鋆mcrypt璅∠嚗寞憒銝:

- @/ _4 v; ~5 |7 k$ z
  1. rpm -qa | grep php-mcrypt
銴鋆賭誨蝣
! u* O" L" h* H$ _7 [' Z7 H% y' X
其蝬脩撱箔php瑼嚗憒phpinfo.php(批捆憒銝)亦臬行mcrypt module

. j$ b' d3 r% G9 ?9 Q& `; L
  1. <?php
    9 A$ ^/ u, [/ i+ X) D" e4 D% W1 x
  2. // Show all information, defaults to INFO_ALL/ z2 h% w# D. Q4 O* i9 a/ Y9 Y, ]
  3. phpinfo();
    2 ~1 K" e0 X( _. J- x/ c4 x# T
  4. ?>
銴鋆賭誨蝣

# C: D) X0 c$ e- @嗅嬌rowser 瑁phpinfo.php嚗蝯憒銝:

& T& @7 V& o( {  t
4 [; L. S1 Y1 v! a, f! M

* H+ @. z% o' b6 S; z& `- I$ f
憒瘝摰鋆php-mcrypt嚗脰摰鋆(摰鋆寞)嚗摰鋆摰敺隞乩餈啣拍車寞銝隞交炎乓
銋敺撠勗臭誑啣神撖蝔撘憒銝嚗
: `: a1 z; A) n, `1 I5 I- D
  1. //撖賣豢啣神
      y: n8 X0 u: V6 X, \$ u
  2. function encrypt($source,$toencrypt){  
    - [) W+ o* y, Z, c5 n$ B
  3. //撖函key   4 K1 f! m; G' ^5 [
  4. $key = $source;  
    + K( A+ h4 T/ _$ N7 |1 e
  5. //雿輻3DES寞撖   8 m& j0 e. f' @0 E, z# c' e! G( Z
  6. $encryptMethod = MCRYPT_TRIPLEDES;
    3 f4 [% p0 N! a  |
  7. //憪靘憓摰冽
    6 H% R' P; o6 R9 p* C: s
  8. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    & V& F$ c& M4 l6 ]% m2 x1 y
  9. //雿輻皂crypt_encrypt賣詨撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪
    3 ]! x9 B; ?0 Z: b) q% v
  10. $encrypted_toencrypt = mcrypt_encrypt($encryptMethod, $key, $toencrypt, MCRYPT_MODE_ECB,$iv);   
    ' D/ ~, ~- d6 o. A) }" z% _3 F6 ]% Y
  11. //唾圾撖敺摮銝' R2 ^5 N7 Q$ W3 t4 T' t' F- Z
  12. return base64_encode($encrypted_toencrypt);  ; ^5 {, s; [, r, H/ X" a5 y( F0 w+ @
  13. }  
    5 e3 T# W2 l7 u5 k' p0 I7 L
  14. //閫撖賣豢啣神( |  s9 \: X' m  k
  15. function decrypt($source,$todecrypt) {  
    ' C9 ~; X' L# g: a( Z6 ^
  16. //閫撖函key嚗敹頝撖函key銝璅   
    2 D# F- x$ {) t; a: [) ?( B
  17. $key = $source;  
    / H% H& R2 @1 G  s% V8 k1 \3 J! H
  18. //閫撖閫base64蝣
    2 U2 ]' U0 m7 o- w! V1 s: a7 w
  19. $todecrypt = base64_decode($todecrypt);7 ^' _4 l) \/ {1 Y4 \! }% r! g/ B
  20. //雿輻3DES寞閫撖$ Y1 Y' h* a3 u, [4 I. r9 A
  21. $encryptMethod = MCRYPT_TRIPLEDES;  % e0 O8 b- }% Z2 w1 x# p1 r
  22. //憪靘憓摰冽
    4 S3 O5 Z+ F' m
  23. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    1 j& C# j6 @0 Y. P' W, j
  24. //雿輻皂crypt_decrypt賣貉圾撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪  4 T8 f- C. X0 ^# W9 T7 I4 J
  25. $decrypted_todecrypt = mcrypt_decrypt($encryptMethod, $key, $todecrypt, MCRYPT_MODE_ECB,$iv);
    ; |* D) s4 R7 c8 D( J- r  a
  26. //唾圾撖敺摮銝
    & }8 S+ B+ u8 \8 ?/ d1 F2 z
  27. return $decrypted_todecrypt;  9 L: C4 h0 D1 I% t+ c6 M
  28. }  ! r$ O/ F+ ?  s, F! i/ g
  29. //撖怠末閫撖賣訾敺嚗撠勗臭誑靘脰皜祈岫鈭
    6 l, w: p  c) ^
  30. //key閮剖
    % h7 i- d% p% U$ B! n- l# j
  31. $source ="1234567890";
    + t5 T& ^: M' j! e
  32. //閬撖摮銝" q. Y1 C3 t8 J
  33. $string ="www.av4u.co";+ S$ [/ k1 ]4 J' l+ F4 N
  34. echo "string=".$string."<br>";8 z1 t/ ?8 n/ V
  35. //脰撖銝阡*蝷箏撖敺摮銝$ z- ^  L* a+ }1 L1 v3 X
  36. $encode = encrypt($source,$string);; X3 k0 P' ~1 T& r
  37. echo "encode=".$encode."<br>";5 S3 w! y2 A4 h% P, H% C5 U# ?
  38. //脰閫撖銝阡*蝷箄圾撖敺摮銝& o# }7 Z: Y! H: y6 |0 \+ D
  39. $decode = decrypt($source,$encode);1 O1 c$ o7 {& e1 Y7 \. f$ z' v
  40. echo "decode=".$decode."<br>";
銴鋆賭誨蝣
; s$ d5 P5 a/ R8 y- X2 ^- a
蝯憒銝:
$ v. X2 C1 |# d9 [# n: J
: s& D  {- `, l5 G( X3 z# b  T
瘜冽:
      憒閫撖蝔瘝雿輻灸ase64蝣潛閰梧頝函雯鞈唾撓嚗交嗥垢⊥閫霈(臬撖敺鞈唾撓航炊嚗雿臬典銝蝬脩抒閫撖舀憿)嚗蝯憒銝:

0 d9 T5 E, a4 l7 J

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

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

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵