43 lines
1.1 KiB
Java
43 lines
1.1 KiB
Java
package com.cbsd.client.verification;
|
|
|
|
import com.cbsd.client.verification.IVerificationInterface;
|
|
import com.cbsd.client.verification.VerifyUtils;
|
|
|
|
/**
|
|
* 校验脚本示例, 实现 IVerificationInterface 接口
|
|
*/
|
|
public class VerificationTemplate implements IVerificationInterface {
|
|
|
|
/**
|
|
* 校验数据
|
|
*
|
|
* @param data 校验数据
|
|
* @param verify 校验位
|
|
* @param verifyUtils 校验工具类
|
|
* @return 校验结果
|
|
*/
|
|
@Override
|
|
public boolean verification(byte[] data, byte[] verify, VerifyUtils verifyUtils) {
|
|
try {
|
|
byte[] verifyCRC = new byte[data.length + verify.length];
|
|
System.arraycopy(data, 0, verifyCRC, 0, data.length);
|
|
System.arraycopy(verify, 0, verifyCRC, data.length, verify.length);
|
|
return verifyUtils.verifyCRC(verifyCRC);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* 描述
|
|
*
|
|
* @return 描述内容
|
|
*/
|
|
@Override
|
|
public String comment() {
|
|
return "";
|
|
}
|
|
|
|
}
|