![]() $Region = Invoke-Command -ComputerName $ComputerName -ScriptBlock ) ContainsKey ( "ComputerName" ) -and $ComputerName -inotin ".", "localhost", "", $env:COMPUTERNAME, "127.0.0.1" ) ) #Append the number of parts to the ETag if there were multiple $Hash = :: ToString ( $BinaryHashArray ). Write-Verbose -Message "Closing the file stream." #Here ComputeHash takes in a Stream object Write-Verbose -Message "The upload is smaller than the minimum threshold and will not use multipart." ComputeHash ( $BinaryHashArray )Įlse #The file is not big enough to use multipart Write-Verbose -Message "Calculating hash of concatenated hashes." #Calculate the hash, ComputeHash() takes in a byte #and then doing an MD5 hash of the concatenation #The MD5 hash is calculated by concatenating all of the MD5 hashes of the parts Write-Verbose -Message "There are $Parts total parts." Write-Verbose -Message "Reading part $Parts : $(::ToString($Temp).Replace("-",::Empty).ToLower())" ComputeHash ( $Buffer, 0, $LengthToRead ) #Only read in the amount of data that is left to be read #ComputeHash takes in a byte array and returns one #Calculate the hash of the part and add it to a byte array #The number of parts in the upload is appended to the end of the ETag, so track that here #FileReader reads from 0 up to the buffer length and places it in the byte array #This reads the file and ensures we haven't reached the end of the file ] $Buffer = New-Object -TypeName System.Byte ( $BlockSize ) #Set the buffer object to the size of upload part Write-Verbose -Message "The upload will use multipart" #If the file is larger than the size to use multipart $FileReader = :: Open ( $FilePath, :: Open, :: Read ) ![]() ![]() #FIPS compliance enforcement must be turned off to use MD5 ![]() #Track the hashes of each part in the array #Track the number of parts that would need to be uploaded ![]() Set-Variable -Name AWSRegions -Value ( ( Get-AWSRegion -GovCloudOnly | Select-Object -ExpandProperty Region ), ( Get-AWSRegion -IncludeChina | Select-Object -ExpandProperty Region ) ) | Select-Object -Unique ) #Make the variable $AWSRegions available to all of the cmdlets Import-Module -Name AWSPowerShell -ErrorAction Stop ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |