FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version

sha512-final

Arguments: context &key return

Finalize and return the SHA512 hash from context in a format determined by the return keyword argument.

return can be one of the following values:

cl-user(4): (setq c (sha512-init))
#S(excl::md-context :ctx 9184192 :size 64)
cl-user(5): (sha512-update c "foo")
cl-user(6): (sha512-final c :return :usb8)
#(247 251 186 110 6 54 248 144 229 111 ...)

;;  Potential problem with :return :integer (or :return unspecified
;;  as the default is :integer). The call is to SHA512-FILE which calls
;;  SHA512-FINAL and returns the value SHA512-FINAL returns.
;;
;;  Here we get the sha512 value in a shell:
% openssl dgst -sha512 -hex cmp04-profmenu.jpg
SHA512(xmldoc/html101/pictures/cmp04-profmenu.jpg)= 083059e92e5cecc3bbcf1707bc0f167564f7981a03b5340b1d1755f84ef04b239929c56c3b08409d31188a8103e24daf1311f5f4d01cb55180b1a000d5edf58f

;; Now we get it with SHA512-FILE:
cl-user(17): (sha512-file "~/cmp04-profmenu.jpg")
428886023486142793197430632417588933862863719105103677963658399518713040127487056708272152409738347556264379546041790497093717768109375086135443767293327
cl-user(18): (format t "~x" *)
83059e92e5cecc3bbcf1707bc0f167564f7981a03b5340b1d1755f84ef04b239929c56c3b08409d31188a8103e24daf1311f5f4d01cb55180b1a000d5edf58f
nil
cl-user(19): 

;; Note the hex values are the same but the leading 0 is not printed
;; by Lisp, which is dealing with the value as an integer. The leading
;; 0 is preserved when the :return is :hex:
cl-user(21): (sha512-file "~/cmp04-profmenu.jpg" :return :hex)
"083059e92e5cecc3bbcf1707bc0f167564f7981a03b5340b1d1755f84ef04b239929c56c3b08409d31188a8103e24daf1311f5f4d01cb55180b1a000d5edf58f"
cl-user(22): 

See MD*, SHA*, HMAC, and other message digest support in miscellaneous.htm. See also digest-final.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 9.0 page.
Created 2015.5.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version