public class DESUtils { private static Key key; private static String KEY_STR = "eloan_yzld"; static { try { KeyGenerator generator = KeyGenerator.getInstance("DES"); SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); secureRandom.setSeed(KEY_STR.getBytes()); generator.init(secureRandom); key = generator.generateKey(); byte[] b = key.getEncoded(); System.out.print("key=============="); for(int i=0; i<b.length; i++) { System.out.print(b[i] + " "); // 本地main 方法跑得到[-80, -60, 19, -33, 112, -75, -12, 93] // 从tomcat中启动时得到[-26, -92, -62, 25, 55, -125, 14, -42] } System.out.println(); generator = null; } catch (Exception e) { throw new RuntimeException(e); } }
...
}
实在想不明白为什么会这样
19:40:24
刚刚把项目打了个war包,扔到linux服务器下跑,结果发现,日志中打出了
这说明在linux下是正常的
20:05:47
实在看不出问题了,一狠心换了个工作空间,完美运行~!