// TODO 待处理

 1 # powershell 编写的某些校验
 2
 3 function listChecks() {
 4     write-host '可用的校验';
 5     write-host 'CRC - 循环冗余校验';
 6     return '-- done';
 7 }
 8
 9 # 字节数组 CRC, 不知道是不是符合CRC定义
10 function crcCheck($byteArray) {
11     if ($byteArray -eq $null) {
12         return 'crc - Null param.';
13     }
14
15     $result = 0xFFFF;
16
17     for ($i = 0; $i -lt $byteArray.length; $i++ ) {
18         $result = $result -bxor $byteArray[$i];
19
20         for ($j = 0; $j -lt 8; $j++) {
21             if (($result % 2) -eq 1) {
22                 $result = [System.Decimal]::ToInt32($result / 2);
23                 $result = 0xA001 -bxor $result
24             } else {
25                 $result = [System.Decimal]::ToInt32($result / 2);
26             }
27         }
28     }
29
30     $crch = [System.Decimal]::ToInt32($result / 256);
31     $crcl = $result % 256;
32     return [System.String]::Format("High, Low = {0}, {1}", $crch.toString("X2"), $crcl.toString("X2"));
33 }
34
35 # 脚本
36 # args[1] : byte array
37 switch($args[0]) {
38     {$_ -eq 'crc'} {crcCheck $args[1] | write-host ; break}
39     default {write-host "没有与 ["  $args[0] "] 相关的实现" ; break}
40 }

--------------

转载于:https://www.cnblogs.com/shadow-abyss/p/11119770.html

powershell some check相关推荐

  1. 如何在PowerShell中使用带有空格和引号的参数运行EXE文件

    本文翻译自:How to run an EXE file in PowerShell with parameters with spaces and quotes How do you run the ...

  2. How to Install Snapd and Snap applications on CentOS 7

    转载来源:https://computingforgeeks.com/install-snapd-snap-applications-centos-7/ How to Install Snapd an ...

  3. SQL Server数据库迁移最佳实践,可降低风险和停机时间

    介绍 (Introduction) The main goal of many organizations, today, is reducing costs while maintaining th ...

  4. [转]Windows Notes And Cheatsheet

    原文:https://github.com/m0chan/m0chan.github.io/blob/master/_posts/2019-07-30-Windows-Notes-and-Cheats ...

  5. oracle 提取当天日志,powershell提取日志内容

    写了一个powershell提取日志内容的脚本,搜索oracle关于ORA的报错信息 #查找结果赋值 $d=Get-ChildItem  c:\test  -Recurse | where{" ...

  6. Python Module_subprocess_调用 Powershell

    目录 目录 前言 Powershell call Python Python call Powershell Powershell发送邮件 最后 前言 使用Python内建的subprocess模块, ...

  7. PowerShell批量设置PATH环境变量

    PowerShell批量设置PATH环境变量 Code #requires -version 4.0 #requires #-runasadministrator# Get the ID and se ...

  8. check_mk自定义监控实践之powershell

    最近在学习check_mk,这是一款基于nagios监控工具,但比nagios更易使用,引起了我的兴趣,我最关注的依然是对自定义监控脚本的支持度.在windows下的实践,其支持的客户端脚本或插件可以 ...

  9. PowerShell Core 6.2 发布,侧重于性能改进

    百度智能云 云生态狂欢季 热门云产品1折起>>>   PowerShell Core 6.2 GA 已发布,PowerShell Core 是 PowerShell 的开源版本,适用 ...

最新文章

  1. 你不知道的z-index
  2. opencv openpose
  3. 【控制】《鲁棒控制-线性矩阵不等式处理方法》-俞立老师-第3章-系统性能分析
  4. 基于heartbeat v1+ldirectord实现LVS的高可用
  5. 【caffe-Windows】caffe+VS2013+Windows无GPU快速配置教程
  6. 地理信息考c语言,南师地理信息系统专业01方向真题C语言
  7. 深圳信息职业技术学校 计算机辅助设计和制造,大学生职业生涯规划书样稿.doc...
  8. 雅虎Yahoo 前段优化 14条军规
  9. php重载求圆锥体积,编写一函数文件,实现求一个圆锥体的体积。
  10. 中台搞了2年,项目叫停,CIO被裁!本以为中台是道送分题,没想到是送命题!...
  11. arr和arr的区别以及数组首元素地址和整个数组地址的区别
  12. 【String字符串分割以及字符串截取】
  13. js项目中常见util方法
  14. 移动新魔百盒M411A_905L3_5621_语音免拆_卡刷固件包
  15. 华为云点学堂为你揭开DevOps转型的秘密
  16. r510服务器开机无显示,联想B320i开机无显示维修案例
  17. css3小狗滑滑梯动画js特效
  18. rosbag录制问题:/use_sim_time set to true and no clock published. Still waiting for valid time...
  19. 动物实验可用计算机模拟,《动物实验类试题》.doc
  20. 第4章:色彩空间类型转换

热门文章

  1. 树莓派使用STEP6:安装git
  2. JS之字符串截取函数substr
  3. Vue之父组件向子组件传递数据
  4. 卷积神经网络(CNN)介绍
  5. mysql-5.7.13-winx64如何安装_mysql 5.7.13 winx64安装配置方法图文教程
  6. mysql主键外键_MySQL主键和外键使用及说明
  7. 安装python要注意什么_安装python注意事项
  8. Django通过中间件实现登录验证demo
  9. 小型移动 webApp Demo 知识点整理
  10. data-role参数表: