Skip to content

Instantly share code, notes, and snippets.

@rxseger
Created August 14, 2016 06:02
Show Gist options
  • Save rxseger/331e4928f9add164489764caffe6e491 to your computer and use it in GitHub Desktop.
Save rxseger/331e4928f9add164489764caffe6e491 to your computer and use it in GitHub Desktop.
crypt(3) command-line wrapper, compile with: cc crypt.c -o crypt -lcrypt
#include <stdio.h>
#include <crypt.h>
int main(int argc, char **argv) {
if (argc < 3) {
fprintf(stderr, "usage: %s key salt\n", argv[0]);
return -1;
}
char *result = crypt(argv[1], argv[2]);
if (!result)
perror("crypt");
else
puts(result);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment