From f44135f835bf62319f9bb8a32e4592a707e5e8c1 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 27 四月 2025 11:09:55 +0800 Subject: [PATCH] SSO登录逻辑再修改 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java index d641b85..157257f 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/CRC16.java @@ -94,7 +94,6 @@ * @param endIndex 鎴涓嬫爣 * @return CRC */ - @SuppressWarnings("unused") public int CRC16_table(byte[] bs, int startIndex, int endIndex) { int x ; int crc = 0xffff; @@ -106,18 +105,20 @@ } return crc ; } + /** - * 16浣嶇殑CRC鍊� 锛屾煡琛ㄦ硶 + * 16浣嶇殑CRC鍊兼槸鏃犵鍙蜂袱瀛楄妭鏁存暟锛� + * @param len 鏁扮粍闀垮害 * @param bs 瀛楄妭鏁扮粍 + * @param crc 鍘熷crc鍊� * @return CRC */ - public short CRC16_table(byte[] bs) { - short x ; - short crc = (short)0xffff; - if(bs != null && bs.length > 0){ - for(byte b : bs){ - x = (short)(crc ^ b) ; - crc = (short)((crc >> 8) ^ crc16_rev_table[x & 0x00FF]) ; + public int CRC16_table(int len, byte[] bs, int crc) { + int x ; + if(bs != null){ + for (int i = 0 ; i < len; i++){ + x = (crc ^ bs[i]) ; + crc = ((crc >> 8) ^ crc16_rev_table[x & 0x00FF]) ; } } return crc ; -- Gitblit v1.8.0