52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2014-12-11 21:02:57 | 芰閰脖 |芰憭批 撣 |摨閬 |梯璅∪
砍敺 IT_man 2014-12-11 22:31 蝺刻摩
6 _  j! a$ M0 T' }1 w8 R1 b
' k2 B9 K* p- p) g/ E
望潭蝬脩摮撖閬,閬銴撖瞍蝞瘜嚗甇日豢3DES撖
3DES撖(Triple DES)嚗臭撖瞍蝞瘜蝔梧3DES望蝔格芋撘嚗銝V蝝寧浩CB璅∪撖急
擐瑼X召inux臬行摰鋆mcrypt璅∠嚗寞憒銝:
. `! H5 c% v9 W% r
  1. rpm -qa | grep php-mcrypt
銴鋆賭誨蝣

9 ^! X( `! t6 u6 L其蝬脩撱箔php瑼嚗憒phpinfo.php(批捆憒銝)亦臬行mcrypt module

& |6 V) k! ?" x9 S* ]
  1. <?php
    * R# D9 \: `7 n# W0 D8 I
  2. // Show all information, defaults to INFO_ALL
    - s% a# [2 j' I( |2 O4 V
  3. phpinfo();
    . E+ ]& G* l6 Y; S3 }5 Q0 Z1 `
  4. ?>
銴鋆賭誨蝣
3 e2 t) D8 ]/ `. y
嗅嬌rowser 瑁phpinfo.php嚗蝯憒銝:

9 j( t) W% A$ B) D, g* R  n

) ^4 x: T5 A2 T2 [9 i  U, K7 y

' `( i* o5 Q% s0 z. r1 R. G
憒瘝摰鋆php-mcrypt嚗脰摰鋆(摰鋆寞)嚗摰鋆摰敺隞乩餈啣拍車寞銝隞交炎乓
銋敺撠勗臭誑啣神撖蝔撘憒銝嚗
5 H! K& A9 W  D: a" P
  1. //撖賣豢啣神
    , M- G8 Y; R5 J
  2. function encrypt($source,$toencrypt){  + x! u5 s3 H( [6 m
  3. //撖函key   
    # g2 M1 r& D- S& V) N2 Q& N; Y
  4. $key = $source;  , t5 J1 S3 H9 n% ]
  5. //雿輻3DES寞撖   - u: V) w8 O5 F- f
  6. $encryptMethod = MCRYPT_TRIPLEDES; 6 O( J9 t: L4 S
  7. //憪靘憓摰冽
    0 R3 J# j$ Y/ H
  8. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    , |5 y; m% J% B( L. c) Q
  9. //雿輻皂crypt_encrypt賣詨撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪
    ) b) ?& A6 W9 b, E9 T
  10. $encrypted_toencrypt = mcrypt_encrypt($encryptMethod, $key, $toencrypt, MCRYPT_MODE_ECB,$iv);   9 \1 g: l# a; N) j/ @/ g- ~. I
  11. //唾圾撖敺摮銝, D& p) \7 d; y3 f  `# j
  12. return base64_encode($encrypted_toencrypt);  
    7 T* _- m7 l0 r( |. l
  13. }  . w3 I  L  l) j* w
  14. //閫撖賣豢啣神
    + n2 S6 ^- P7 ?
  15. function decrypt($source,$todecrypt) {  
    # a. @, b# g; {4 W. m
  16. //閫撖函key嚗敹頝撖函key銝璅   
    6 ?# l. L! ^0 R  n
  17. $key = $source;  # Y/ q1 K6 c( ]0 K3 ?
  18. //閫撖閫base64蝣& J/ V+ @% K! S& M: |$ @4 N( R. C
  19. $todecrypt = base64_decode($todecrypt);: s' l& f! |; K" b1 {# o9 G
  20. //雿輻3DES寞閫撖
    . L) F- L% g* G' t* A9 p, m$ w
  21. $encryptMethod = MCRYPT_TRIPLEDES;  $ l: a, z! g7 e  e1 j' ?
  22. //憪靘憓摰冽
    0 R% o. i3 J9 `" C% J3 r' d
  23. $iv = mcrypt_create_iv(mcrypt_get_iv_size($encryptMethod,MCRYPT_MODE_ECB), MCRYPT_RAND);  
    3 P  Z& u: n# q% M  E
  24. //雿輻皂crypt_decrypt賣貉圾撖嚗MCRYPT_MODE_ECB銵函內雿輻汞CB璅∪  
    4 `! h. U& o% v! B9 p1 J
  25. $decrypted_todecrypt = mcrypt_decrypt($encryptMethod, $key, $todecrypt, MCRYPT_MODE_ECB,$iv);
    5 X5 R: r! H; i0 D4 B$ ^
  26. //唾圾撖敺摮銝
    * D' X5 v# F/ @' A2 `9 z, {
  27. return $decrypted_todecrypt;  6 ^  `0 T- c4 P- f
  28. }  
    9 v( z( J5 z( @4 Q) e  Z2 x
  29. //撖怠末閫撖賣訾敺嚗撠勗臭誑靘脰皜祈岫鈭- L  d/ @3 |3 g# i2 h" B7 s
  30. //key閮剖
    # w- T! }1 J; u7 w. r
  31. $source ="1234567890";
    8 Z" t9 G5 ^/ Q1 X* l% e& ^
  32. //閬撖摮銝) C) K9 {6 J- R& z0 d, @: T
  33. $string ="www.av4u.co";- T5 |8 u2 M- w7 j& p
  34. echo "string=".$string."<br>";+ X3 [/ r; y3 v4 |
  35. //脰撖銝阡*蝷箏撖敺摮銝
    ! I6 u2 W9 a) E  w- e
  36. $encode = encrypt($source,$string);
    ( E9 i7 P- A8 p2 R# [: f
  37. echo "encode=".$encode."<br>";: J3 [! u- X0 b! E
  38. //脰閫撖銝阡*蝷箄圾撖敺摮銝
      U0 {. U  K3 m. H
  39. $decode = decrypt($source,$encode);
    : z* ]' A1 M6 S3 |% `
  40. echo "decode=".$decode."<br>";
銴鋆賭誨蝣

, h' I" y7 x" }/ o8 N; }7 P
蝯憒銝:
) m) y- q# h8 m9 W. c- s# Y( F
/ W9 ^# N* v+ F: r6 |6 M
瘜冽:
      憒閫撖蝔瘝雿輻灸ase64蝣潛閰梧頝函雯鞈唾撓嚗交嗥垢⊥閫霈(臬撖敺鞈唾撓航炊嚗雿臬典銝蝬脩抒閫撖舀憿)嚗蝯憒銝:
, M0 O9 l, c9 a: ]5 E1 D' m' Z

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

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

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵