| Allegro CL version 9.0 Moderately revised from 8.2. 8.2 version |
Arguments: context &key return
Finalize and return the SHA224 hash from context in a format determined by the return keyword argument.
return can be one of the following values:
:integer
(the default): the return value is an
integer of up to 128 bits representing the digest. Warning: note that
an integer representation of the digest potentially loses information
if the generated signature has leading octets containing only
zeroes. Care should be taking when using this return type if you
intend to further encode the signature (such as to a base64-encoded
string). See the example below.
cl-user(4): (setq c (sha224-init)) #S(excl::md-context :ctx 9183104 :size 28) cl-user(5): (sha224-update c "foo") cl-user(6): (sha224-final c :return :usb8) #(8 8 246 78 96 213 137 121 252 182 ...) ;; Potential problem with :return :integer (or :return unspecified ;; as the default is :integer). The call is to SHA224-FILE which calls ;; SHA224-FINAL and returns the value SHA224-FINAL returns. ;; ;; Here we get the sha224 value in a shell: % openssl dgst -sha224 -hex uninstall.jpg SHA224(uninstall.jpg)= 012d03e402813fa87201182a9fa8dc71d5662e07a3298e6e3fee902a ;; Now we get it with SHA224-FILE: cl-user(17): (sha224-file "~/uninstall.jpg") 123830469993168619693673182033704503020973917482279183198628778026 cl-user(18): (format t "~x" *) 12d03e402813fa87201182a9fa8dc71d5662e07a3298e6e3fee902a 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): (sha224-file "~/unistall.jpg" :return :hex) "012d03e402813fa87201182a9fa8dc71d5662e07a3298e6e3fee902a" 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 has had moderate revisions compared to the 8.2 page.
Created 2019.8.20.
| Allegro CL version 9.0 Moderately revised from 8.2. 8.2 version |