Skip to content

Instantly share code, notes, and snippets.

@manualbashing
Last active June 12, 2023 14:12

Revisions

  1. manualbashing renamed this gist Jun 12, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. manualbashing renamed this gist Jun 12, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Get-DeterministricGuid.ps1 → New-DeterministricGuid.ps1
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    function Get-DeterministicGuid {
    function New-DeterministicGuid {
    param
    (
    [String] $InputObject
  3. manualbashing revised this gist Jun 12, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Get-DeterministricGuid.ps1
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    function Get-DeterministricGuid {
    function Get-DeterministicGuid {
    param
    (
    [String] $InputObject
  4. manualbashing revised this gist Jun 12, 2023. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions Get-DeterministricGuid.ps1
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,5 @@ function Get-DeterministricGuid {
    ForEach-Object {
    $null = $Hash.Append($_.ToString("x2"))
    }
    $hashString = $Hash.ToString().ToUpper()
    return [Guid]::New($hashString)
    return [Guid]::New($Hash.ToString())
    }
  5. manualbashing revised this gist Jun 12, 2023. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Get-DeterministricGuid.ps1
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,6 @@ function Get-DeterministricGuid {
    [String] $InputObject
    )


    $Hash = New-Object System.Text.StringBuilder

    $([System.Security.Cryptography.HashAlgorithm]::Create('MD5')).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($InputObject)) |
  6. manualbashing created this gist Jun 12, 2023.
    16 changes: 16 additions & 0 deletions Get-DeterministricGuid.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    function Get-DeterministricGuid {
    param
    (
    [String] $InputObject
    )


    $Hash = New-Object System.Text.StringBuilder

    $([System.Security.Cryptography.HashAlgorithm]::Create('MD5')).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($InputObject)) |
    ForEach-Object {
    $null = $Hash.Append($_.ToString("x2"))
    }
    $hashString = $Hash.ToString().ToUpper()
    return [Guid]::New($hashString)
    }