From: Chris Hanson Date: Thu, 14 Jan 1999 18:35:23 +0000 (+0000) Subject: Add procedure BLOWFISH-FILE?. X-Git-Tag: 20090517-FFI~4691 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=26f095ca448e5194c74f3bb0f0a556c38d442327;p=mit-scheme.git Add procedure BLOWFISH-FILE?. --- diff --git a/v7/src/runtime/blowfish.scm b/v7/src/runtime/blowfish.scm index 89b517eb4..cce443034 100644 --- a/v7/src/runtime/blowfish.scm +++ b/v7/src/runtime/blowfish.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: blowfish.scm,v 1.5 1999/01/14 18:28:32 cph Exp $ +$Id: blowfish.scm,v 1.6 1999/01/14 18:35:23 cph Exp $ Copyright (c) 1997, 1999 Massachusetts Institute of Technology @@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;; package: () (declare (usual-integrations)) - + (define-primitives (md5 1) (md5-init 0) @@ -37,7 +37,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (define (blowfish-available?) (and (implemented-primitive-procedure? md5-init) (implemented-primitive-procedure? blowfish-cfb64-substring))) - + (define (blowfish-encrypt-string plaintext key-string encrypt?) (blowfish-encrypt-substring plaintext 0 (string-length plaintext) key-string encrypt?)) @@ -72,6 +72,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (if (not (string=? (read-line port) blowfish-file-header)) (error:bad-range-argument port 'READ-BLOWFISH-FILE-HEADER))) +(define (blowfish-file? pathname) + (let ((line (call-with-binary-input-file pathname read-line))) + (and (not (eof-object? line)) + (string=? line blowfish-file-header)))) + (define blowfish-file-header "Blowfish, 16 rounds")