Ar an naoú lá is fiche de mí Méan Fómhair, scríobh Jari Aalto:
Here are small patches that I have had in my own version of crypt
for
years. I recently spoke with Karl about submitting them forward, so here
they are.
Thank you Jari!
(The below only differs from your changes in whitespace, but I post in in
order to have at least one copy of the change end up on -patches.)
APPROVE COMMIT
NOTE: This patch has been committed.
xemacs-packages/os-utils/ChangeLog addition:
2007-09-29 Jari Aalto <jari.aalto AT cante.net>
* crypt.el
(crypt-encryption-type-get): New function.
(crypt-encryption-type-set): New function.
(crypt-decrypt-buffer): New interactive function.
(crypt-encrypted-p): Call `crypt-encryption-type-set' to set
correct `crypt-encryption-type'.
(crypt-build-encryption-alist): Add entry for
bcrypt program: *.bfe files.
XEmacs Packages source patch:
Diff command: cvs -q diff -u
Files affected: xemacs-packages/os-utils/crypt.el
===================================================================
RCS
Index: xemacs-packages/os-utils/crypt.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/os-utils/crypt.el,v
retrieving revision 1.7
diff -u -r1.7 crypt.el
--- xemacs-packages/os-utils/crypt.el 2006/09/04 06:16:11 1.7
+++ xemacs-packages/os-utils/crypt.el 2007/10/02 09:27:09
@@ -919,7 +919,19 @@
t
nil
)
- ;; Add new elements here ...
+ (list 'bfe
+ ;; See
http://sourceforge.net/projects/bcrypt
+ crypt-encryption-magic-regexp crypt-encryption-magic-regexp-inverse
+ (or crypt-encryption-file-extension "\\(\\.bfe\\)$")
+ "bcrypt" "bcrypt"
+ '("")
+ '("")
+ "BFE"
+ nil
+ t
+ nil
+ )
+ ;; Add new elements here ...
))
(defconst crypt-encryption-alist (crypt-build-encryption-alist)
@@ -1552,6 +1564,24 @@
(setq alist (cdr alist))))
found))))
+(defun crypt-encryption-type-get (file)
+ "Determine type of encryption from file extension."
+ (let (ret
+ regexp)
+ (dolist (elt crypt-encryption-alist)
+ (setq regexp (nth 3 elt))
+ (if (and (stringp regexp)
+ (string-match regexp file))
+ (return (nth 0 elt))))))
+
+(defun crypt-encryption-type-set ()
+ "Set `crypt-encryption-type'"
+ (let (type)
+ (if (setq type (crypt-encryption-type-get buffer-file-name))
+ (progn
+ (setq crypt-encryption-type type)
+ (crypt-rebuild-tables)))))
+
(defun crypt-encrypted-p (&optional buffer)
;; Returns t if current buffer, or optionally BUFFER, is encrypted.
;; Look for MAGIC-REGEXP and absence of MAGIC-REGEXP-INVERSE. If so, then
@@ -1567,7 +1597,7 @@
(save-restriction
(widen)
(goto-char (point-min))
-
+ (crypt-encryption-type-set)
(let ((magic-regexp (crypt-get-magic-regexp crypt-encryption-type))
(magic-regexp-inverse (crypt-get-magic-regexp-inverse
crypt-encryption-type))
@@ -2127,6 +2157,17 @@
(save-excursion (set-buffer buffer)
(crypt-encrypt-region (point-min) (point-max) key decrypt)))
+(defun crypt-decrypt-buffer (key)
+ "Use KEY to decrypt current buffer."
+ (interactive
+ (let (pass)
+ (barf-if-buffer-read-only)
+ (list
+ (crypt-read-string-no-echo
+ "Decrypt buffer using key: "))))
+ (setq crypt-buffer-encryption-key key)
+ (crypt-encrypt-region (point-min) (point-max) key 'decrypt))
+
;;;; ENCODING
@@ -2748,7 +2789,7 @@
;; Similar to `insert-file-contents' except decoding/decrypting of FILE
;; attempted. See `crypt-insert-file' and `crypt-auto-decode-insert'
-;;
+;;
(defun crypt-insert-file-contents (file)
(let (temp-buffer
temp-list
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta