delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/16/22:34:07

From: James MacDonald <trill AT Xnetbook DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Implementing CRYPT algorithm in DOS?
Date: Wed, 16 Jul 1997 20:59:16 +0100
Organization: Trills and Technologies
Distribution: world
Message-ID: <ro7oeAAUgSzzEwKV@netbook.demon.co.uk>
NNTP-Posting-Host: netbook.demon.co.uk
MIME-Version: 1.0
Lines: 67
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Is it possible to implement crypt() in DOS?
I need to compile this program :

/* simple password generator by Nelson Minar (minar AT reed DOT edu)
 * copyright 1991, all rights reserved.
 * You can use this code as long as my name stays with it.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

extern char *getpass();

int main(argc, argv)
int argc;
char *argv[];
{
  static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ
RSTUVWXYZ0123456789./";
  char salt[3];
  char * plaintext;
  int i;

  if (argc < 2) {
    srandom(time(0));           /* may not be the BEST salt, but its
close */
    salt[0] = saltChars[random() % 64];
    salt[1] = saltChars[random() % 64];
    salt[2] = 0;
  }
  else {
    salt[0] = argv[1][0];
    salt[1] = argv[1][1];
    salt[2] = '\0';
    if ((strchr(saltChars, salt[0]) == NULL) || (strchr(saltChars,
salt[1]) == NULL))
      fprintf(stderr, "illegal salt %s\n", salt), exit(1);
  }

  plaintext = getpass("plaintext: ");
  printf("%s\n", crypt(plaintext, salt));
  return 0;
}

DJGPP simply stops with a linker error. How do I get an implementation
of CRYPT for DOS?
A library, crypt.a, would be nice :)

I'm writing a Windows desktop switcher app, and I've hardcoded the
password into the EXE for security, as a series of BIOS scancodes. But,
if I could do :

deskflip 4e2411aee140             in AUTOEXEC.BAT, giving it the
password, it would be much, much better. I need to :

Get a crypt library
Work out how to implement crypt decoding
Build it into the program :)


-- 
Revised anti-spam in use : remove X to reply - 
'Xnetbook' becomes 'netbook'

Anti-spam thermonuclear warheads cheap at only $300!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019