Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hash command #554

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Add hash command #554

merged 3 commits into from
Nov 29, 2023

Conversation

vinc
Copy link
Owner

@vinc vinc commented Nov 28, 2023

Add a hash command to compute the SHA256 digest of a file.

By default it'll only show half of the digest (same width as MD5) because the VGA screen is only 80 chars long.

/tmp
> hash /tmp/lisp/*.lsp
CC96B368B747E0C1988D96BFE4DF6527 /tmp/lisp/colors.lsp
5BA4E29B643AFE102D136786D1148FB4 /tmp/lisp/factorial.lsp
61E20049870E053CA52AC878ED063C9C /tmp/lisp/fetch.lsp
9C075B38308B785539D7052100250663 /tmp/lisp/fibonacci.lsp
4337A80396D3E6CCA664D61A95361E67 /tmp/lisp/geotime.lsp
9C0DD640E8DC34C04BA925906F71D911 /tmp/lisp/ntp.lsp
B9C1239245B00DD89CEA35334511CC2C /tmp/lisp/pi.lsp
589CBBC31EB7B2C521A4D66CA4506201 /tmp/lisp/sum.lsp

/tmp
> hash lisp/*.lsp
CC96B368B747E0C1988D96BFE4DF6527 lisp/colors.lsp
5BA4E29B643AFE102D136786D1148FB4 lisp/factorial.lsp
61E20049870E053CA52AC878ED063C9C lisp/fetch.lsp
9C075B38308B785539D7052100250663 lisp/fibonacci.lsp
4337A80396D3E6CCA664D61A95361E67 lisp/geotime.lsp
9C0DD640E8DC34C04BA925906F71D911 lisp/ntp.lsp
B9C1239245B00DD89CEA35334511CC2C lisp/pi.lsp
589CBBC31EB7B2C521A4D66CA4506201 lisp/sum.lsp

/tmp
> hash *.txt
6DFD0C65EE6CAE71124406A3126D10BD alice.txt
E04EFE3389B3A36BE5FF6D80A486BBA7 machines.txt

/tmp
> hash *.txt --full
6DFD0C65EE6CAE71124406A3126D10BD4D563858A51C5404D9E82194390D8767 alice.txt
E04EFE3389B3A36BE5FF6D80A486BBA76681686A2956A59A7CEB5440439DD548 machines.txt

@vinc
Copy link
Owner Author

vinc commented Nov 28, 2023

Screenshot showing the colored output:

hash

@vinc vinc marked this pull request as ready for review November 28, 2023 21:53
@vinc vinc merged commit ae6d47a into trunk Nov 29, 2023
1 check passed
@vinc vinc deleted the feature/hash-command branch November 29, 2023 23:43
@vinc vinc mentioned this pull request Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant