wjc
2023-06-28 14de918a79943e4961b09fa01ed320c6cad41f2e
HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/utils/mqtt/HouseIdSecretUtil.java
New file
@@ -0,0 +1,30 @@
package com.hdl.sdk.link.core.utils.mqtt;
/**
 * 住宅密钥获取工具类
 *
 * @author yangtao
 * @date 2021.2.26
 */
public class HouseIdSecretUtil {
    public static String getSecret(String homeId) {
        String temp = new StringBuffer().append(homeId).reverse().toString();
        if (temp.length() > 16) {
            return temp.substring(0, 16);
        }
        //长度不够16位用0补齐
        for (int i = temp.length(); i < 16; i++) {
            temp += "0";
        }
        return temp;
    }
    public static String getSecret(Long homeId) {
       return getSecret(homeId.toString());
    }
    public static void main(String[] args) {
        System.out.println(getSecret("1363358800782790658"));
    }
}