News for hackers. Stuff that matters.
Re:What Is the Randomart Image For? by johnmaguire on Tuesday February 21, 2023 @11:50AM (#34883366)
Something like this also works:

    hash="4e575a5ee4af2925477c9eea887ff560d23a586dbaf90b616d26c47ec429ca13"
    [[ "$hash" == "$(shasum -a 256 file | awk '{print $1 }')" ]] && echo "Valid" || echo "Invalid checksum"
I use that little if-statement in some build systems.
Re:What Is the Randomart Image For? by coldpie on Tuesday February 21, 2023 @11:56AM (#34883424)
See my edit, apparently shasum's -c can read from stdin so you could simplify your scriptlet even further :)
Re:What Is the Randomart Image For? by lozf on Wednesday February 22, 2023 @06:55AM (#34894349)
Indeed,

      echo '98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4  some_file' | sha256sum -c   
also works (with and without passing `-n` to echo, because the `-c` option ensures the file is checked without even noticing any new line). Thanks :)