Making crypto.lsp work for Windows with GnuWin32

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
xytroxon
Posts: 296
Joined: Tue Nov 06, 2007 3:59 pm
Contact:

Making crypto.lsp work for Windows with GnuWin32

Post by xytroxon »

To get crypto.lsp to work with Windows, go to GnuWin32:
http://gnuwin32.sourceforge.net/
GnuWin32 provides ports of tools with a GNU or similar open source license, to MS-Windows (Microsoft Windows 95 / 98 / ME / NT / 2000 / XP / 2003 / Vista / 2008)
Download and install the OpenSSL package.
http://gnuwin32.sourceforge.net/packages.html


Edit file: C:\Program Files\newlisp\modules\cypto.lsp
(Note: For some strange historic reason, Windows "crypto.dll" is instead called "libeay32.dll")

Code: Select all

(context 'crypto)

; set library to path-name of the library on your platform OS
;
(set 'files '(
	"C:/Program Files/gnuwin32/bin/libeay32.dll" ;<<< add this line
	"/usr/lib/libcrypto.so"
	"/usr/lib/libcrypto.so.0.9.8"
	"/usr/lib/libcrypto.so.0.9.7"
	"/usr/lib/libcrypto.so.0.9.6"
	"/usr/lib/libcrypto.so.4"
	"/usr/lib/libcrypto.dylib"
))
>newlisp

>(load (string (env "NEWLISPDIR") "/modules/crypto.lsp"))

;; expected result from module manual
;; (crypto:md5 "ABC") => "902fbdd2b1df0c4f70b4a5d23525e932"

> (crypto:md5 "ABC")
"902fbdd2b1df0c4f70b4a5d23525e932"
>

;; expected result from module manual
;; (crypto:sha1 "ABC") => "3c01bdbb26f358bab27f267924aa2c9a03fcfdb8"

> (crypto:sha1 "ABC")
"3c01bdbb26f358bab27f267924aa2c9a03fcfdb8"
>

-- xytroxon
"Many computers can print only capital letters, so we shall not use lowercase letters."
-- Let's Talk Lisp (c) 1976

Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

Post by Cyril »

With newLISP you can grow your lists from the right side!

xytroxon
Posts: 296
Joined: Tue Nov 06, 2007 3:59 pm
Contact:

Post by xytroxon »

I have FOUR versions of libeay32.dll :)

Date - Bytes
10/02/2007 - 806,912
10/28/2007 - 1,089,536
05/02/2007 - 1,097,728 <- earliest date is bigger than above?
09/03/2008 - 1,177,600

But not: c:/windows/system32/libeay32.dll

Also the GnuWin32 version contains the command line tool:
C:\Program Files\GnuWin32\bin\openssl.exe

opensll.exe can encrypt/decrypt data and files with many functions not wrapped by crypto.lsp
http://www.openssl.org/docs/apps/enc.html

Also:
C:\Program Files\GnuWin32\man\pdf\openssl-man.pdf
provides lots (if not cryptic) documentation.

And finally, GnuWin32 allows other Gnu programs to be used by Windows users in a controlled manor. That is, all Gnu apps are found together by the path:
C:\Program Files\GnuWin32\

-- xytroxon
"Many computers can print only capital letters, so we shall not use lowercase letters."
-- Let's Talk Lisp (c) 1976

Locked