Aug 7

Anybody else noticed that the Solaris 'crypt' command isn't in common use in the Linux community?


This proved to be an issue for me a little while back while transferring some data between companies and systems. Fortunately a quick visit to OpenSolaris provided the source, which only required a small modification in order to allow it to be compiled for use under Linux..
67c67
< ret = des_crypt(buf, &buf[8]);
---
> ret = crypt(buf, &buf[8]);

Yet another advantage to Solaris being open-sourced...


Posted by Mike Scott

| Top Exits (0)

0 Trackbacks

  1. No Trackbacks

3 Comments

Display comments as(Linear | Threaded)
  1. Dave Whiting says:

    Do you know if crypt is used when you're using -x in vi under Solaris? I've used this in the past for encrypting files quickly and I'd love to have it for other Unix flavours.

  2. Mike says:

    Yep - certainly does.. indeed, it actually uses the "crypt" command itself to do the encryption/decryption:

    4507: execve("/usr/bin/vi", 0xEFFFFBA0, 0xEFFFFBB0) argc = 3
    4516: execve("/sbin/sh", 0xEFFFF4D0, 0xEFFFFBDC) argc = 3
    4516: execve("/usr/bin/crypt", 0x00061234, 0x0006124C) argc = 2
    4518: execve("/sbin/sh", 0xEFFFF468, 0xEF770C60) argc = 3
    4518: execve("/usr/bin/crypt", 0x00061234, 0x0006124C) argc = 2
    4518: ** process killed **
    4520: execve("/sbin/sh", 0xEFFFD4E8, 0xEF770C60) argc = 3
    4520: execve("/usr/bin/crypt", 0x00061234, 0x0006124C) argc = 2
    4516: ** process killed **
    4520: ** process killed **

  3. Steve Parker says:

    Also, I found that sizeof(long) was 8 on Linux, but 4 on Solaris; I had to change "long seed" to "int seed" to get the correct results.

Add Comment


Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA