#file computes the 512SHA for a given string and writes it to a file

$String = $env:docker_auth
$HashName = "SHA512"
$StringBuilder = New-Object System.Text.StringBuilder 
[System.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String))|%{ 
[Void]$StringBuilder.Append($_.ToString("x2")) 
} 

if([System.IO.File]::Exists("<%= $passfile %>")){
    $CurrentContent = Get-Content -Path "<%= $passfile %>"
    if($CurrentContent -eq $StringBuilder.ToString()){
        exit 0
    }
}

exit 1
