echo
appends a newline, so you're comparing the hashes of different strings. Use printf
instead:
$ printf 'A' | sha256sum
559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd -
$ printf 'A\n' | sha256sum
06f961b802bc46ee168555f066d28f4f0e9afdf3f88174c1ee6f9de004fc30a0 -