首页 > 其他 > 详细

CRC32

时间:2020-04-06 01:15:25      阅读:78      评论:0      收藏:0      [点我收藏+]

在与api交互中请求需提交文件的crc32 (循环冗余校验)

function Get-CRC32 {
    param(
        [Parameter(Mandatory = $False)]
        [Int]$InitialCRC = 0,
        [Parameter(Mandatory = $True)]
        [Byte[]]$Buffer
    )

    Add-Type -TypeDefinition @"
        using System;
        using System.Diagnostics;
        using System.Runtime.InteropServices;
        using System.Security.Principal;
    
        public static class CRC32
        {
            [DllImport("ntdll.dll")]
            public static extern UInt32 RtlComputeCrc32(
                UInt32 InitialCrc,
                Byte[] Buffer,
                Int32 Length);
        }
"@
    [CRC32]::RtlComputeCrc32($InitialCRC, $Buffer, $Buffer.Length)
}

 

CRC32

原文:https://www.cnblogs.com/feiyucha/p/12640073.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!