Function | Package: excl | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## digest-string

Arguments: name string start end external-format return foreign

You may need to evaluate `(require :digest)` to load the digest code before calling this function.

Using digest-init (which creates a context), digest-update (which updates the context with the argument string), and digest-final (which calculates the hash of the resulting context), this function computes the hash for string.

name can be one of the symbols md2, md4, md5, sha1, sha224, sha256, sha384, sha512, and rmd160, specifying the type of hashing.

The start and end arguments specify the portion of the string to be considered and the external-format argument specifies the external hashing of the string that will be used to update the context.

To use the entire string, specify 0 for start and `nil` (or `(length string)`).

You can use :default as the value of external-format to use to the default external format. These arguments, along with string, are passed to digest-update.

The format of the result, just as for digest-final, is determined by the return keyword argument. The possible values are `:integer`, `:usb8`, and `:hex`. See digest-final for information on these values and the corresponding formats of the returned value.

If foreign is non-`nil`, then string must (despite the argument name) be an integer address in foreign memory (such as what would be passed to sys:memref) and the bytes contained at that address are used as the input to the digest function.

    cl-user(4): (digest-string 'md5 "foo" 0 nil :default :integer nil)
    229609063533823256041787889330700985560
    cl-user(5): (digest-string 'md5 "foo" 0 nil :default :usb8 nil)
    #(172 189 24 219 76 194 248 92 237 239 ...)
    cl-user(6):

See MD5, SHA*, HMAC, RC4, and other message digest support in miscellaneous.htm.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version