在与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)
}

 

相关文章:

  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
  • 2021-10-25
  • 2022-02-05
猜你喜欢
  • 2021-07-30
  • 2022-01-07
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
相关资源
相似解决方案