Óà Java ½âÃÜ C# ¼ÓÃܵÄÊý¾Ý(DES)
Óà Java ½âÃÜ C# ¼ÓÃܵÄÊý¾Ý(DES)
[ÔÎĵØÖ·£ºhttp://yidinghe.cnblogs.com/articles/449212.html]
½ñÌìÅöÉÏÒ»¼þÁîÎÒÍ·´óµÄÊÂÇé¡£ÎÒÃǵÄϵͳҪºÍÒ»¸öÍⲿϵͳ½øÐÐͨѶ£¬´«Ê䷽ʽÊDzÉÓà DES Ëã·¨¶ÔÏûÏ¢½øÐмÓÃÜ£¬ÔÙÓà BASE64 ±àÂë¡£²»¹ý¶Ô·½ÏµÍ³ÊÇÓà C# дµÄ¡£Æ½Ì¨²»Ò»Ñù£¬ÓÚÊÇÎҺͶÔÃæµÄÀÏÐÖÏȲâÊÔһϼÓÃܽâÃÜ¡£ÕâÒ»²âÊÔÎÊÌâ¾ÍÀ´ÁË¡£Á½±ß²ÉÓÃͬÑùµÄÃÜÔ¿£¬¶Ôͬһ¸ö×Ö·û´®¼ÓÃܳöÀ´µÄ½á¹û²»Ò»Ñù¡£Ôõô°ìÄØ£¿ÎÒÏÈ°ÑËûÄDZߵĴúÂëÒª¹ýÀ´ÁË£¬ËûÊÇÕâÑùдµÄ(C#)£º
public static string Encrypt(string message, string key)
{
DES des = new DESCryptoServiceProvider();
des.Key = Encoding.UTF8.GetBytes(key);
des.IV = Encoding.UTF8.GetBytes(key);
byte[] bytes = Encoding.UTF8.GetBytes(message);
byte[] resultBytes = des.CreateEncryptor().TransformFinalBlock(bytes, 0, bytes.Length);
return Convert.ToBase64String(resultBytes);
}
¶øÎÒÕâ±ßÄØ£¬ÊÇÓà Java ÕâÑùдµÄ£¨½ö½ö¼ÓÃܵ½×Ö½Ú´®£¬BASE64 ±àÂëÊÇÔÚÁíÒ»¸öÀàÀ£º
public static byte[] desEncrypt(String message, String key) throws Exception {
Cipher cipher = Cipher.getInstance("DES");
DESKeySpec desKeySpec = new DESKeySpec(key.getBytes("UTF-8"));
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey secretKey = keyFactory.generateSecret
Ïà¹ØÎĵµ£º
ÏîÄ¿ÖÐÄã²»µÃ²»ÖªµÄ11¸öJavaµÚÈý·½Àà¿â
ÔðÈα༣ºñûÀï×÷ÕߣºJavaeye 2009-11-02 À´Ô´£ºIT168ÍøÕ¾
Îı¾Tag£º ITÒµ½ç Java Java¿ª·¢¹¤¾ß
¡¡¡¡¡¾IT168 ÆÀÂÛ¡¿JavaµÚÈý·½library ecosystemÊÇÒ»¸öºÜ¹ãÀ«µÄ·¶³ë¡£²»¾ÃÇ°ÓÐÈË׫ÎÄ£ºÃ¿¸öÏîÄ¿ÖУ¬Äã±ØÐëÖªµÀµÄ11¸öJavaµÚÈý·½Àà¿â¡£
¡¡¡¡µ¥Ôª²âÊÔ
¡¡¡¡ ......
´ËÎÄÖеĴúÂëÖ÷ÒªÁгöÁ¬½ÓÊý¾Ý¿âµÄ¹Ø¼ü´úÂ룬ÆäËû·ÃÎÊÊý¾Ý¿â´úÂëÊ¡ÂÔ
¡¡¡¡1¡¢Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
¡¡¡¡¡¡¡¡Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
¡¡¡¡¡¡¡¡String url="jdbc:oracle:thin:@localhost:1521:orcl";
¡¡¡¡¡¡¡¡//orclΪÊý¾Ý¿âµÄSID
¡¡¡¡¡¡¡¡String user="test";
¡ ......
¶à̬µÄÄ¿µÄ
ͨ¹ýÀàÐÍת»»£¬°ÑÒ»¸ö¶ÔÏóµ±×÷ËüµÄ»ùÀà¶ÔÏó¶Ô´ý¡£
´ÓÏàͬµÄ»ùÀàÅÉÉú³öÀ´µÄ¶à¸öÅÉÉúÀà¿É±»µ±×÷ͬһ¸öÀàÐͶԴý£¬¿É¶ÔÕâЩ²»Í¬µÄÀàÐͽøÐÐͬÑùµÄ´¦Àí¡£
ÕâЩ²»Í¬ÅÉÉúÀàµÄ¶ÔÏóÏìӦͬһ¸ö·½·¨Ê±µÄÐÐΪÊÇÓÐËù²î±ðµÄ£¬ÕâÕýÊÇÕâЩÏàËƵÄÀàÖ®¼ä±Ë´ËÇø±ðµÄ²»Í¬Ö®´¦¡£
¶¯Ì¬°ó¶¨
½«Ò»¸ö·½·¨µ÷ÓúÍÒ»¸ö·½·¨Ö÷ÌåÁ¬½Óµ½Ò»Æð ......
ÔÎÄ£ºhttp://www.cnblogs.com/whitetiger/archive/2007/03/27/689620.html
ÔÚBETA2ÖУ¬¡£NETÌṩÁËÒÔϵÄNAMESPACE£º
System.Data Namespace
System.Data.OleDb £¨ºÍBETA1ÖÐÒѾ²»Í¬ÁË£¬ËùÒÔÈç¹ûÄÃBETA1ÖеijÌÐòµ½BETA2ÖÐÀ´ÔËÐп϶¨²»¿ÉÒԵģ©
Èç¹ûÏë½²Çå³þÕâЩ¶«Î÷£¬ÎÒ²»ÈÏΪÊÇÎÒ¿ÉÒÔ×÷µ½µÄ£¬ËùÒÔÎÒÏëͨ¹ýһЩ¾ ......
Óöµ½¹ýÕâÑùÒ»¸öÇé¿ö£¬ÐèÒªÓÃjava¶ÁÈ¡Ò»¸ö200MµÄÎı¾¸ñʽÎļþ£¬¶øÇÒ»¹ÐèÒª¶ÔÎļþµÄÄÚÈÝ×ö½âÎö£¬½øÐзִʡ£Èç¹ûÓÃJVMµÄĬ
ÈÏÉèÖã¬ÀûÓÃScannerÀàÖ»ÄܶÁ³ö4M´óСÄÚÈÝ£¬ÓÚÊÇÎÒ¾ÍÔÚÍøÉÏËÑË÷£¬µ«ÊÇÍøÉÏûÓÐÕÒµ½Ò»ÆªÎÄÕÂÊÇÎÒËùÐèÒªµÄÄÚÈÝ¡£ÓÚÊÇÎÒÖ»ºÃ·thinking
in
java£¬·¢ÏÖÁËÒ»¸öjavaµÄnioÀïÓиöMappedByteBufferÀ࣬ËûµÄ×÷Ó ......