Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Verify pkg hash #8

Closed
coatless opened this issue Jun 7, 2018 · 0 comments
Closed

Verify pkg hash #8

coatless opened this issue Jun 7, 2018 · 0 comments

Comments

@coatless
Copy link
Collaborator

coatless commented Jun 7, 2018

Per Simon's e-mail on R-SIG-MAC, we're going to implement a check that verifies the md5 hash of the file.

Sample function:

#1 Path to File
#2 md5 Hash to Check Against
check_md5_hash() {
	
    # Obtain file hash
    FILE_HASH=$(md5 $1 | awk '{print $4}')
    
    # MD5 (path/to/file.pkg) = c29700c4e7b2914073ef7e741eb105bc
    #  1 %         2        %3%      4 
     
    # Check against hash
    if [ "$FILE_HASH" = "$2" ]; then
       echo 0
    else 
       exit 1
    fi
}

Hard coded hashes:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant