Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加BCC/CRC/LRC校验功能 #199

Merged
merged 7 commits into from
Jan 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
baiy committed Jan 17, 2023
commit 7f6f47bf13ab3b6800b6fe85cf29da2254ff417c
13 changes: 12 additions & 1 deletion packages/ctool-core/src/tools/dataValidation/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ export class Bcc {
private readonly _error: string = ""

constructor(input: Text) {

if (input.isError()){
this._error = input.toString()
return;
}
if (!input.isAscii()) {
this._error = "Input Error"
return;
}
input.toHexArray().forEach(item => {
this._dec = this._dec ^ parseInt(item, 16);
this._count++;
})
}

isError() {
Expand Down