23 points · by nayak · 3y ago · 14 comments
> echo "please hash this data" | sha256sum
f2ccc47bcb79799071eab33aa4311e6764769681bb9052ae444cb6e2d87427c8 -
This sum is not the sum of "please hash this data" but instead it is the sum of "please hash this data\n" where "\n" represents not a literal backslash and n, but a newline character. The unwanted newline is supplied by the echo command, obviously.The proper way to have done this example (edit: on BSD, macOS, etc.) would be:
> echo -n "please hash this data" | sha256sum
62f73749b40cc70f453320e1ffc37e405ba50474b5db68ad436e64b61fbb8cf0 -
And then we would see the actual sha256sum for the example data used.Edit: Forget this, an even better way is posted by others below! Thanks!
printf '%s' "my string" | sha256sumhttps://gitlab.com/gitlab-com/www-gitlab-com/-/merge_request...
echo -n "please hash this data"
...to output the bytes "-n please hash this data\n", which is even more misleading than the extra newline echo outputs normally.¹: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/e...
> Gitaly is a Git RPC service for handling all the git calls made by GitLab
So I think this means that a major piece of gitlab now supports sha256 git repos? But probably not everything and therefore we can't actually push sha256 git repos to gitlab yet?
> While there is still some work we need to do in other parts of the GitLab application before SHA-256 repositories can be used, this milestone is important.
Somehow I managed to skim over and miss that; I was expecting a "what this means for gitlab" or "next steps" section.