Skip to content

Instantly share code, notes, and snippets.

@SMoni
Created July 5, 2021 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SMoni/d2caba1342e4458c32964cf8ab0dd2e0 to your computer and use it in GitHub Desktop.
Save SMoni/d2caba1342e4458c32964cf8ab0dd2e0 to your computer and use it in GitHub Desktop.
Combine two guids
function combineIds() {
param(
[Parameter()]
[Guid]$First,
[Parameter()]
[Guid]$Second
)
process {
$firstAsArray = $First.ToByteArray()
$secondAsArray = $Second.ToByteArray()
for($index = $firstAsArray.Count - 1; $index -ge 0; $index--) {
$byteFirst = $firstAsArray.GetValue($index)
$byteSecond = $secondAsArray.GetValue($index)
$firstAsArray[$index] = $byteFirst -bxor $byteSecond
}
[Guid]$firstAsArray
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment