summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2011-06-21 16:55:22 +0800
committerLeo Liu <sdl.web@gmail.com>2011-06-21 16:55:22 +0800
commit7f3f739fa4e1351a5b8a2dcd290f79c2e3baba38 (patch)
treee30470b57676daad3c70b40a6725707473ca2c50 /lisp/subr.el
parentbd168c0651be4fd71141ba19d54389b26258e5bb (diff)
downloademacs-7f3f739fa4e1351a5b8a2dcd290f79c2e3baba38.tar.gz
New primitive secure-hash supporting md5, sha-1 and sha-2
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index b328b7e17b7..4d2f3b1808c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2600,6 +2600,14 @@ Otherwise, return nil."
(get-char-property (1- (field-end pos)) 'field)
raw-field)))
+(defun sha1 (object &optional start end binary)
+ "Return the SHA1 (Secure Hash Algorithm) of an OBJECT.
+OBJECT is either a string or a buffer. Optional arguments START and
+END are character positions specifying which portion of OBJECT for
+computing the hash. If BINARY is non-nil, return a string in binary
+form."
+ (secure-hash 'sha1 object start end binary))
+
;;;; Support for yanking and text properties.