Skip to content

Commit

Permalink
Fix hash check (v2fly#263)
Browse files Browse the repository at this point in the history
* Fix hash check

* chore

Co-authored-by: Markson <[email protected]>
Co-authored-by: IceCodeNew <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2023
1 parent c8bc8dd commit b4035a8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions install-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,12 @@ download_v2ray() {
fi

# Verification of V2Ray archive
for LISTSUM in 'md5' 'sha1' 'sha256' 'sha512'; do
SUM="$(${LISTSUM}sum "$ZIP_FILE" | sed 's/ .*//')"
CHECKSUM="$(grep ${LISTSUM^^} "$ZIP_FILE".dgst | grep "$SUM" -o -a | uniq)"
if [[ "$SUM" != "$CHECKSUM" ]]; then
echo 'error: Check failed! Please check your network or try again.'
return 1
fi
done
CHECKSUM=$(awk -F '= ' '/256=/ {print $2}' < "${ZIP_FILE}.dgst")
LOCALSUM=$(sha256sum "$ZIP_FILE" | awk '{printf $1}')
if [[ "$CHECKSUM" != "$LOCALSUM" ]]; then
echo 'error: SHA256 check failed! Please check your network or try again.'
return 1
fi
}

decompression() {
Expand Down

0 comments on commit b4035a8

Please sign in to comment.