1 $ErrorActionPreference = "Stop" 2 3 Set-Variable tempfile -option Constant -value "tempfile" 4 CompareFiles($f1, $f2, $i)5function CompareFiles($f1, $f2, $i) { 6 $f1_content = $(Get-Content $f1) 7 $f2_content = $(Get-Content $f2) 8 9 if (Compare-Object $f1_content $f2_content) { 10 Write-Host -NoNewline "ERROR" 11 exit $i 12 } else { 13 Write-Host -NoNewline "OK" 14 } 15 } 16 main()17function main() { 18 $i = 0 19 foreach ($opt in @("Ref", "Opt")) { 20 Write-Output "$opt" 21 22 foreach ($version in @(16, 19)) { 23 foreach ($type in @("i", "d", "id")) { 24 $i++ 25 26 if ("Ref" -eq $opt) { 27 vs2015\build\Argon2RefGenKAT.exe $type $version > $tempfile 28 } else { 29 vs2015\build\Argon2OptGenKAT.exe $type $version > $tempfile 30 } 31 32 if (19 -eq $version) { 33 $kats = "kats\argon2" + $type 34 } else { 35 $kats = "kats\argon2" + $type + "_v" + $version 36 } 37 38 Write-Host -NoNewline "Argon2$type v=$version : " 39 CompareFiles $tempfile $kats $i 40 Write-Output "" 41 } 42 } 43 } 44 45 if (Test-Path $tempfile) { 46 Remove-Item $tempfile 47 } 48 } 49 50 main 51