From 3f41182984d69d7fae703776edd1591f48dff93f Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期三, 22 十一月 2023 17:13:05 +0800 Subject: [PATCH] 2023年11月22日17:12:40 --- HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java | 35 +---------------------------------- 1 files changed, 1 insertions(+), 34 deletions(-) diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java index e4f6a9d..2c2f4a1 100644 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java +++ b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java @@ -203,41 +203,8 @@ } public static int byteArrayToInt(byte[] b) { - int i = (b[0] & 0xFF) * 256 * 256 * 256 + (b[1] & 0xFF) * 256 * 256 + (b[2] & 0xFF) * 256 + (b[3] & 0xFF); - return i; + return (b[0] & 0xFF) * 256 * 256 * 256 + (b[1] & 0xFF) * 256 * 256 + (b[2] & 0xFF) * 256 + (b[3] & 0xFF); } - /** - * 瑙e瘑 - * - * @param contentByte 寰呰В瀵嗗緟瀛楃涓瞙exStr - * @param contentByte 瀵嗛挜 - * @return - */ - public static byte[] decrypt(byte[] contentByte) { - try { - //KEY杞崲 - Key key = new SecretKeySpec("HDLRDCENTER1985.".getBytes(), "AES"); - //瑙e瘑 - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec ivps = new IvParameterSpec("HDLRDCENTER1985.".getBytes()); - cipher.init(Cipher.DECRYPT_MODE, key, ivps); - byte[] result = cipher.doFinal(contentByte); - return result; - } catch (NoSuchAlgorithmException e) { - LogUtils.e(e.getMessage()); - } catch (InvalidKeyException e) { - LogUtils.e(e.getMessage()); - } catch (NoSuchPaddingException e) { - LogUtils.e(e.getMessage()); - } catch (BadPaddingException e) { - LogUtils.e(e.getMessage()); - } catch (IllegalBlockSizeException e) { - LogUtils.e(e.getMessage()); - } catch (InvalidAlgorithmParameterException e) { - LogUtils.e(e.getMessage()); - } - return null; - } } -- Gitblit v1.8.0