aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-08-23 18:25:48 +0000
committerStefan Monnier2007-08-23 18:25:48 +0000
commit7b5bd91f856e5b3c8a27d72d86532441a19c3835 (patch)
tree39614fc06552b91496c27ae6af4c0fc7895efb24
parentefdee9ddf0dfed6a5078052be8f83b00430d253f (diff)
downloademacs-7b5bd91f856e5b3c8a27d72d86532441a19c3835.tar.gz
emacs-7b5bd91f856e5b3c8a27d72d86532441a19c3835.zip
Fix up comment style.
(sha1-F0, sha1-F1, sha1-F2, sha1-F3, sha1-S1, sha1-S5, sha1-S30) (sha1-OP, sha1-add-to-H): Use new-style backquotes.
-rw-r--r--lisp/gnus/sha1.el153
1 files changed, 76 insertions, 77 deletions
diff --git a/lisp/gnus/sha1.el b/lisp/gnus/sha1.el
index 0411a983bad..146aa6374a0 100644
--- a/lisp/gnus/sha1.el
+++ b/lisp/gnus/sha1.el
@@ -123,93 +123,93 @@ If this variable is set to nil, use internal function only."
123 (defconst sha1-K3-high 51810) ; (string-to-number "CA62" 16) 123 (defconst sha1-K3-high 51810) ; (string-to-number "CA62" 16)
124 (defconst sha1-K3-low 49622) ; (string-to-number "C1D6" 16) 124 (defconst sha1-K3-low 49622) ; (string-to-number "C1D6" 16)
125 125
126;;; original definition of sha1-F0. 126 ;; original definition of sha1-F0.
127;;; (defmacro sha1-F0 (B C D) 127 ;; (defmacro sha1-F0 (B C D)
128;;; (` (logior (logand (, B) (, C)) 128 ;; (` (logior (logand (, B) (, C))
129;;; (logand (lognot (, B)) (, D))))) 129 ;; (logand (lognot (, B)) (, D)))))
130;;; a little optimization from GnuPG/cipher/sha1.c. 130 ;; a little optimization from GnuPG/cipher/sha1.c.
131 (defmacro sha1-F0 (B C D) 131 (defmacro sha1-F0 (B C D)
132 (` (logxor (, D) (logand (, B) (logxor (, C) (, D)))))) 132 `(logxor ,D (logand ,B (logxor ,C ,D))))
133 (defmacro sha1-F1 (B C D) 133 (defmacro sha1-F1 (B C D)
134 (` (logxor (, B) (, C) (, D)))) 134 `(logxor ,B ,C ,D))
135;;; original definition of sha1-F2. 135 ;; original definition of sha1-F2.
136;;; (defmacro sha1-F2 (B C D) 136 ;; (defmacro sha1-F2 (B C D)
137;;; (` (logior (logand (, B) (, C)) 137 ;; (` (logior (logand (, B) (, C))
138;;; (logand (, B) (, D)) 138 ;; (logand (, B) (, D))
139;;; (logand (, C) (, D))))) 139 ;; (logand (, C) (, D)))))
140;;; a little optimization from GnuPG/cipher/sha1.c. 140 ;; a little optimization from GnuPG/cipher/sha1.c.
141 (defmacro sha1-F2 (B C D) 141 (defmacro sha1-F2 (B C D)
142 (` (logior (logand (, B) (, C)) 142 `(logior (logand ,B ,C)
143 (logand (, D) (logior (, B) (, C)))))) 143 (logand ,D (logior ,B ,C))))
144 (defmacro sha1-F3 (B C D) 144 (defmacro sha1-F3 (B C D)
145 (` (logxor (, B) (, C) (, D)))) 145 `(logxor ,B ,C ,D))
146 146
147 (defmacro sha1-S1 (W-high W-low) 147 (defmacro sha1-S1 (W-high W-low)
148 (` (let ((W-high (, W-high)) 148 `(let ((W-high ,W-high)
149 (W-low (, W-low))) 149 (W-low ,W-low))
150 (setq S1W-high (+ (% (* W-high 2) 65536) 150 (setq S1W-high (+ (% (* W-high 2) 65536)
151 (/ W-low (, (/ 65536 2))))) 151 (/ W-low ,(/ 65536 2))))
152 (setq S1W-low (+ (/ W-high (, (/ 65536 2))) 152 (setq S1W-low (+ (/ W-high ,(/ 65536 2))
153 (% (* W-low 2) 65536)))))) 153 (% (* W-low 2) 65536)))))
154 (defmacro sha1-S5 (A-high A-low) 154 (defmacro sha1-S5 (A-high A-low)
155 (` (progn 155 `(progn
156 (setq S5A-high (+ (% (* (, A-high) 32) 65536) 156 (setq S5A-high (+ (% (* ,A-high 32) 65536)
157 (/ (, A-low) (, (/ 65536 32))))) 157 (/ ,A-low ,(/ 65536 32))))
158 (setq S5A-low (+ (/ (, A-high) (, (/ 65536 32))) 158 (setq S5A-low (+ (/ ,A-high ,(/ 65536 32))
159 (% (* (, A-low) 32) 65536)))))) 159 (% (* ,A-low 32) 65536)))))
160 (defmacro sha1-S30 (B-high B-low) 160 (defmacro sha1-S30 (B-high B-low)
161 (` (progn 161 `(progn
162 (setq S30B-high (+ (/ (, B-high) 4) 162 (setq S30B-high (+ (/ ,B-high 4)
163 (* (% (, B-low) 4) (, (/ 65536 4))))) 163 (* (% ,B-low 4) ,(/ 65536 4))))
164 (setq S30B-low (+ (/ (, B-low) 4) 164 (setq S30B-low (+ (/ ,B-low 4)
165 (* (% (, B-high) 4) (, (/ 65536 4)))))))) 165 (* (% ,B-high 4) ,(/ 65536 4))))))
166 166
167 (defmacro sha1-OP (round) 167 (defmacro sha1-OP (round)
168 (` (progn 168 `(progn
169 (sha1-S5 sha1-A-high sha1-A-low) 169 (sha1-S5 sha1-A-high sha1-A-low)
170 (sha1-S30 sha1-B-high sha1-B-low) 170 (sha1-S30 sha1-B-high sha1-B-low)
171 (setq sha1-A-low (+ ((, (intern (format "sha1-F%d" round))) 171 (setq sha1-A-low (+ (,(intern (format "sha1-F%d" round))
172 sha1-B-low sha1-C-low sha1-D-low) 172 sha1-B-low sha1-C-low sha1-D-low)
173 sha1-E-low 173 sha1-E-low
174 (, (symbol-value 174 ,(symbol-value
175 (intern (format "sha1-K%d-low" round)))) 175 (intern (format "sha1-K%d-low" round)))
176 (aref block-low idx) 176 (aref block-low idx)
177 (progn 177 (progn
178 (setq sha1-E-low sha1-D-low) 178 (setq sha1-E-low sha1-D-low)
179 (setq sha1-D-low sha1-C-low) 179 (setq sha1-D-low sha1-C-low)
180 (setq sha1-C-low S30B-low) 180 (setq sha1-C-low S30B-low)
181 (setq sha1-B-low sha1-A-low) 181 (setq sha1-B-low sha1-A-low)
182 S5A-low))) 182 S5A-low)))
183 (setq carry (/ sha1-A-low 65536)) 183 (setq carry (/ sha1-A-low 65536))
184 (setq sha1-A-low (% sha1-A-low 65536)) 184 (setq sha1-A-low (% sha1-A-low 65536))
185 (setq sha1-A-high (% (+ ((, (intern (format "sha1-F%d" round))) 185 (setq sha1-A-high (% (+ (,(intern (format "sha1-F%d" round))
186 sha1-B-high sha1-C-high sha1-D-high) 186 sha1-B-high sha1-C-high sha1-D-high)
187 sha1-E-high 187 sha1-E-high
188 (, (symbol-value 188 ,(symbol-value
189 (intern (format "sha1-K%d-high" round)))) 189 (intern (format "sha1-K%d-high" round)))
190 (aref block-high idx) 190 (aref block-high idx)
191 (progn 191 (progn
192 (setq sha1-E-high sha1-D-high) 192 (setq sha1-E-high sha1-D-high)
193 (setq sha1-D-high sha1-C-high) 193 (setq sha1-D-high sha1-C-high)
194 (setq sha1-C-high S30B-high) 194 (setq sha1-C-high S30B-high)
195 (setq sha1-B-high sha1-A-high) 195 (setq sha1-B-high sha1-A-high)
196 S5A-high) 196 S5A-high)
197 carry) 197 carry)
198 65536))))) 198 65536))))
199 199
200 (defmacro sha1-add-to-H (H X) 200 (defmacro sha1-add-to-H (H X)
201 (` (progn 201 `(progn
202 (setq (, (intern (format "sha1-%s-low" H))) 202 (setq ,(intern (format "sha1-%s-low" H))
203 (+ (, (intern (format "sha1-%s-low" H))) 203 (+ ,(intern (format "sha1-%s-low" H))
204 (, (intern (format "sha1-%s-low" X))))) 204 ,(intern (format "sha1-%s-low" X))))
205 (setq carry (/ (, (intern (format "sha1-%s-low" H))) 65536)) 205 (setq carry (/ ,(intern (format "sha1-%s-low" H)) 65536))
206 (setq (, (intern (format "sha1-%s-low" H))) 206 (setq ,(intern (format "sha1-%s-low" H))
207 (% (, (intern (format "sha1-%s-low" H))) 65536)) 207 (% ,(intern (format "sha1-%s-low" H)) 65536))
208 (setq (, (intern (format "sha1-%s-high" H))) 208 (setq ,(intern (format "sha1-%s-high" H))
209 (% (+ (, (intern (format "sha1-%s-high" H))) 209 (% (+ ,(intern (format "sha1-%s-high" H))
210 (, (intern (format "sha1-%s-high" X))) 210 ,(intern (format "sha1-%s-high" X))
211 carry) 211 carry)
212 65536))))) 212 65536))))
213 ) 213 )
214 214
215;;; buffers (H0 H1 H2 H3 H4). 215;;; buffers (H0 H1 H2 H3 H4).
@@ -433,11 +433,10 @@ hash of a portion of OBJECT.
433If BINARY is non-nil, return a string in binary form." 433If BINARY is non-nil, return a string in binary form."
434 (if (stringp object) 434 (if (stringp object)
435 (sha1-string object binary) 435 (sha1-string object binary)
436 (save-excursion 436 (with-current-buffer object
437 (set-buffer object)
438 (sha1-region (or beg (point-min)) (or end (point-max)) binary)))) 437 (sha1-region (or beg (point-min)) (or end (point-max)) binary))))
439 438
440(provide 'sha1) 439(provide 'sha1)
441 440
442;;; arch-tag: c0f9abd0-ffc1-4557-aac6-ece7f2d4c901 441;; arch-tag: c0f9abd0-ffc1-4557-aac6-ece7f2d4c901
443;;; sha1.el ends here 442;;; sha1.el ends here