FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Moderately revised from 8.2.
8.2 version


Arguments: context &key return

Finalize and return the SHA384 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 (sha384-init))
#S(excl::md-context :ctx 9183040 :size 48)
cl-user(5): (sha384-update c "foo")
cl-user(6): (sha384-final c :return :usb8)
#(152 193 31 253 253 213 64 103 107 26 ...)

;;  Potential problem with :return :integer (or :return unspecified
;;  as the default is :integer). The call is to SHA384-FILE which calls
;;  SHA384-FINAL and returns the value SHA384-FINAL returns.
;;  Here we get the sha384 value in a shell:
% openssl dgst -sha384 -hex alpha7.png 
SHA384(xmldoc/html101/pictures/alpha7.png)= 050636aaa2227c310baf6bd61ad776ee570e5397c34bbcfc70e77c64732f77815014ea901e82295680cf1884aceaa58c

;; Now we get it with SHA384-FILE:
cl-user(17): (sha384-file "~/alpha7.png")
cl-user(18): (format t "~x" *)

;; 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): (sha384-file "~/alpha7.png" :return :hex)

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

Copyright (c) 1998-2017, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had moderate revisions compared to the 8.2 page.
Created 2017.2.15.

Allegro CL version 9.0
Moderately revised from 8.2.
8.2 version