Skip to content

Instantly share code, notes, and snippets.

@majorpbx
majorpbx / Get-HashValues-New.ps1
Created June 14, 2021 20:11
Get-HashValues-New.ps1
# Start Hash value function
Function Get-HashValues {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,ValueFromPipeline=$True)]
[ValidateScript({If ((-Not (Test-Path -Path "$_")) -and ((Get-Item -Path "$_").Length -ne 0)) { } return $true })]
[String]$FilePath,
[Parameter(Mandatory=$False,ValueFromPipeline=$True)]
[Int]$SByte = 0,
[Parameter(Mandatory=$False,ValueFromPipeline=$True)]
# Setup CRC32 function
Set-Alias crc32 Get-Crc32
<#
.NOTES
Author: greg zakharov
#>
$asm = Add-Type -Mem @'
[DllImport("ntdll.dll")]
# Start - Function to get available Peripherals Components for the given GD-ROM
Function Get-DCComponent {
Param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
$Comp
)
Switch ($Comp) {
# Optional Peripherals Supported
"1" { return "Mouse" }
@majorpbx
majorpbx / Get-CRC16.ps1
Last active November 18, 2020 06:04
PowerShell CRC-16 Script
Function Get-CRC16 {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string]$String,
[Parameter(Mandatory=$false, ValueFromPipeline=$true)]
$CRCValue # For future verification
)
$CRC = 0xFFFF # Set to 0x0000 for CRC-16/XMODEM, ACORN, LTE output